home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 6 / QRZ Ham Radio Callsign Database - Volume 6.iso / pc / files / dsp / dspkgctr.z / dspkgctr / gcc / config / dsp16.md < prev    next >
Encoding:
Text File  |  1992-06-08  |  91.5 KB  |  4,001 lines

  1. ;;- Machine description for the Motorola dsp561XX for GNU C compiler
  2. ;;   Copyright ( C ) 1988 Free Software Foundation, Inc.
  3. ;;
  4. ;;    $Header: /usr1/dsp/cvsroot/source/gcc/config/dsp16.md,v 1.2 91/09/18 15:34:41 jeff Exp $
  5. ;;      $Id: dsp16.md,v 1.2 91/09/18 15:34:41 jeff Exp $
  6. ;;
  7. ;; This file is part of GNU CC.
  8.  
  9. ;; GNU CC is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 1, or ( at your option )
  12. ;; any later version.
  13.  
  14. ;; GNU CC is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ;; GNU General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU CC; see the file COPYING.  If not, write to
  21. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  24.  
  25. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  26. ;;- updates for most instructions.
  27.  
  28. ;;  %letter escapes for operand printing. (via PRINT_OPERAND).
  29. ;;  %d - print the accumulator name, disregard MEM_IN_STRUCT kludge.
  30. ;;  %e - print 1 after accumulator operand. No affect on non-accum reg.
  31. ;;  %f - print x: or y: before memory reference operand.
  32. ;;  %g - print alternate of x or y half-register.
  33. ;;  %h - print 0 after accumulator operand.
  34. ;;  %i - strip the 0/1 off an x or y half-register.
  35. ;;  %j - n register associated with r register.
  36. ;;  %k - print 2 after accumulator operand.
  37. ;;  %m - print the source reg name, without a trailing 0 or 1.
  38. ;;  %o - print the accumulator name with a trailing 10.
  39.  
  40. ;;  %p - output this as a pointer size constant.
  41. ;;  %q - output this as an integer size constant.
  42. ;;  %r - output this as a long size constant.
  43.  
  44. ;;
  45. ;;  ...........................................................................
  46. ;;
  47. ;;          MOVES, LOADS, STORES
  48. ;;
  49. ;;  ...........................................................................
  50. ;;
  51.  
  52.     
  53. ;; allow a PSImode value to be loaded into any register, but preferentially
  54. ;; load it into an A register. The A must come last - otherwise we risk 
  55. ;; messing up the code that does subunion stuff.
  56.  
  57. ( define_expand "movpsi"
  58.   [ ( set
  59.       ( match_operand:PSI 0 "general_operand" "" )
  60.       ( match_operand:PSI 1 "general_operand" "" ))
  61.   ]
  62.   ""
  63.   "
  64. {
  65.     if ( MEM == GET_CODE ( operands[0] ) &&
  66.     ( MEM == GET_CODE ( operands[1] ) ||
  67.      CONSTANT_P ( operands[1] ) ||
  68.      CONST_DOUBLE == GET_CODE ( operands[1] )))
  69.     {
  70.     operands[1] = force_reg ( PSImode, operands[1] );
  71.     }
  72. }" )
  73.  
  74. ( define_insn ""
  75.   [ ( set
  76.       ( match_operand:PSI 0 "register_operand" "=*D,*S*DA,m,*S*DA,*S*DA" )
  77.       ( match_operand:PSI 1 "general_operand" "*S*D,*S*DA,*S*DA,m,i" ))
  78.   ]
  79.   ""
  80.   "*
  81. {
  82.     return move_pointer ( operands );
  83. }" "1" )
  84.  
  85. ( define_insn ""
  86.   [ ( set
  87.       ( match_operand:PSI 0 "general_operand" "=*D,*S*DA,m,*S*DA,*S*DA" )
  88.       ( match_operand:PSI 1 "register_operand" "*S*D,*S*DA,*S*DA,m,i" ))
  89.   ]
  90.   ""
  91.   "*
  92. {
  93.     return move_pointer ( operands );
  94. }" "1" )
  95.  
  96. ( define_expand "movqi"
  97.   [ ( set
  98.       ( match_operand:QI 0 "general_operand" "" )
  99.       ( match_operand:QI 1 "general_operand" "" ))
  100.   ]
  101.   ""
  102.   "
  103. {
  104.     if ( MEM == GET_CODE ( operands[0] ) &&
  105.     ( MEM == GET_CODE ( operands[1] ) ||
  106.      CONSTANT_P ( operands[1] ) ||
  107.      CONST_DOUBLE == GET_CODE ( operands[1] )))
  108.     {
  109.     operands[1] = force_reg ( QImode, operands[1] );
  110.     }
  111. }" )
  112.  
  113. ( define_insn ""
  114.   [ ( set
  115.       ( match_operand:QI 0 "register_operand" "=*D,*S,<>m,*S*D,*S*D" )
  116.       ( match_operand:QI 1 "general_operand" "*S*A*D,*S*A*D,*S*A*D,<>m,i" ))
  117.   ]
  118.   ""
  119.   "*
  120. {
  121.     return move_singleword ( operands );
  122. }" "1" )
  123.  
  124. ( define_insn ""
  125.   [ ( set
  126.       ( match_operand:QI 0 "general_operand" "=*D,*S,<>m,*S*D,*S*D" )
  127.       ( match_operand:QI 1 "register_operand" "*S*A*D,*S*A*D,*S*A*D,<>m,i" ))
  128.   ]
  129.   ""
  130.   "*
  131. {
  132.     return move_singleword ( operands );
  133. }" "1" )
  134.  
  135. ( define_expand "movsi"
  136.   [ ( set
  137.       ( match_operand:SI 0 "general_operand" "" )
  138.       ( match_operand:SI 1 "general_operand" "" ))
  139.   ]
  140.   ""
  141.   "
  142. {
  143.     if ( MEM == GET_CODE ( operands[0] ) &&
  144.     ( MEM == GET_CODE ( operands[1] ) ||
  145.      CONSTANT_P ( operands[1] ) ||
  146.      CONST_DOUBLE == GET_CODE ( operands[1] )))
  147.     {
  148.     operands[1] = force_reg ( SImode, operands[1] );
  149.     }
  150. }" )
  151.  
  152. ( define_insn ""
  153.   [ ( set
  154.       ( match_operand:SI 0 "register_operand" "=*D,*S,<>m,*S*D,*S*D" )
  155.       ( match_operand:SI 1 "general_operand" "*S*A*D,*S*A*D,*S*A*D,<>m,i" ))
  156.   ]
  157.   ""
  158.   "*
  159. {
  160.     return move_singleword ( operands );
  161. }" "1" )
  162.  
  163. ( define_insn ""
  164.   [ ( set
  165.       ( match_operand:SI 0 "general_operand" "=*D,*S,<>m,*S*D,*S*D" )
  166.       ( match_operand:SI 1 "register_operand" "*S*A*D,*S*A*D,*S*A*D,<>m,i" ))
  167.   ]
  168.   ""
  169.   "*
  170. {
  171.     return move_singleword ( operands );
  172. }" "1" )
  173.  
  174. ( define_expand "movdi"
  175.   [ ( set
  176.       ( match_operand:DI 0 "general_operand" "" )
  177.       ( match_operand:DI 1 "general_operand" "" ))
  178.   ]
  179.   ""
  180.   "
  181. {
  182.     if ( MEM == GET_CODE ( operands[0] ) &&
  183.     ( MEM == GET_CODE ( operands[1] ) ||
  184.      CONSTANT_P ( operands[1] ) ||
  185.      CONST_DOUBLE == GET_CODE ( operands[1] )))
  186.     {
  187.     operands[1] = force_reg ( DImode, operands[1] );
  188.     }
  189. }" )
  190.  
  191. ( define_insn ""
  192.   [ ( set
  193.       ( match_operand:DI 0 "register_operand" "=*D,*S,<>m,*D*S,*D*S" )
  194.       ( match_operand:DI 1 "general_operand" "*D*S,*D*S,*D*S,<>m,Gi" ))
  195.   ]
  196.   ""
  197.   "*
  198. {
  199.     return move_doubleword ( 0, operands );
  200. }" "1" )
  201.  
  202. ( define_insn ""
  203.   [ ( set
  204.       ( match_operand:DI 0 "general_operand" "=*D,*S,<>m,*D*S,*D*S" )
  205.       ( match_operand:DI 1 "register_operand" "*D*S,*D*S,*D*S,<>m,Gi" ))
  206.   ]
  207.   ""
  208.   "*
  209. {
  210.     return move_doubleword ( 0, operands );
  211. }" "1" )
  212.  
  213. ( define_expand "movsf"
  214.   [ ( set
  215.       ( match_operand:SF 0 "general_operand" "" )
  216.       ( match_operand:SF 1 "general_operand" "" ))
  217.   ]
  218.   ""
  219.   "
  220. {
  221.     if ( MEM == GET_CODE ( operands[0] ) &&
  222.     ( MEM == GET_CODE ( operands[1] ) ||
  223.      CONSTANT_P ( operands[1] ) ||
  224.      CONST_DOUBLE == GET_CODE ( operands[1] )))
  225.     {
  226.     operands[1] = force_reg ( SFmode, operands[1] );
  227.     }
  228. }" )
  229.  
  230. ( define_insn ""
  231.   [ ( set
  232.       ( match_operand:SF 0 "register_operand" "=*D,*S,<>m,*D*S,*D*S" )
  233.       ( match_operand:SF 1 "general_operand" "*D*S,*D*S,*D*S,<>m,G" ))
  234.   ]
  235.   ""
  236.   "*
  237. {
  238.     return move_doubleword ( 1, operands );
  239. }" "1" )
  240.  
  241. ( define_insn ""
  242.   [ ( set
  243.       ( match_operand:SF 0 "general_operand" "=*D,*S,<>m,*D*S,*D*S" )
  244.       ( match_operand:SF 1 "register_operand" "*D*S,*D*S,*D*S,<>m,G" ))
  245.   ]
  246.   ""
  247.   "*
  248. {
  249.     return move_doubleword ( 1, operands );
  250. }" "1" )
  251.  
  252. ( define_expand "movdf"
  253.   [ ( set
  254.       ( match_operand:DF 0 "general_operand" "" )
  255.       ( match_operand:DF 1 "general_operand" "" ))
  256.   ]
  257.   ""
  258.   "
  259. {
  260.     if ( MEM == GET_CODE ( operands[0] ) &&
  261.     ( MEM == GET_CODE ( operands[1] ) ||
  262.      CONSTANT_P ( operands[1] ) ||
  263.      CONST_DOUBLE == GET_CODE ( operands[1] )))
  264.     {
  265.     operands[1] = force_reg ( DFmode, operands[1] );
  266.     }
  267. }" )
  268.   
  269. ( define_insn ""
  270.   [ ( set
  271.       ( match_operand:DF 0 "register_operand" "=*D,*S,<>m,*D*S,*D*S" )
  272.       ( match_operand:DF 1 "general_operand" "*D*S,*D*S,*D*S,<>m,G" ))
  273.   ]
  274.   ""
  275.   "*
  276. {
  277.     return move_doubleword ( 1, operands );
  278. }" "1" )
  279.  
  280. ( define_insn ""
  281.   [ ( set
  282.       ( match_operand:DF 0 "general_operand" "=*D,*S,<>m,*D*S,*D*S" )
  283.       ( match_operand:DF 1 "register_operand" "*D*S,*D*S,*D*S,<>m,G" ))
  284.   ]
  285.   ""
  286.   "*
  287. {
  288.     return move_doubleword ( 1, operands );
  289. }" "1" )
  290.  
  291. ;;
  292. ;;  ...........................................................................
  293. ;;
  294. ;;          BLOCKMOVES
  295. ;;
  296. ;;  ...........................................................................
  297. ;;
  298.  
  299. ( define_expand "movstrsi"
  300.   [ ( parallel [ ( set ( match_operand:BLK 0 "memory_operand" "" )
  301.                ( match_operand:BLK 1 "memory_operand" "" ))
  302.          ( use ( match_operand:SI 2 "general_operand" "" ))
  303.          ( use ( match_operand:SI 3 "general_operand" "" )) ] )
  304.   ]
  305.   ""
  306.   "
  307. {
  308.     rtx op0_reg, op1_reg, cpy_reg;
  309.  
  310.     op0_reg = gen_reg_rtx ( PSImode );
  311.     emit_move_insn ( op0_reg, force_reg ( PSImode, XEXP ( operands[0], 0 )));
  312.     
  313.     op1_reg = gen_reg_rtx ( PSImode );
  314.     emit_move_insn ( op1_reg, force_reg ( PSImode, XEXP ( operands[1], 0 )));
  315.     
  316.     cpy_reg = gen_reg_rtx ( DImode );
  317.  
  318.     if ( CONST_DOUBLE == GET_CODE ( operands[2] ))
  319.     {
  320.     operands[2] = gen_rtx ( CONST_INT, VOIDmode, 
  321.                    CONST_DOUBLE_LOW ( operands[2] ));
  322.     }
  323.     
  324.     emit_insn (
  325.            gen_rtx ( PARALLEL, VOIDmode,
  326.             gen_rtvec ( 7,
  327.                    gen_rtx ( CLOBBER, VOIDmode, op0_reg ),
  328.                    gen_rtx ( CLOBBER, VOIDmode, op1_reg ),
  329.                    gen_rtx ( USE, VOIDmode, operands[2] ),
  330.                    gen_rtx ( CLOBBER, VOIDmode, cpy_reg ),
  331.                    gen_rtx ( SET, VOIDmode, operands[0],
  332.                         operands[1] ),
  333.                    gen_rtx ( USE, VOIDmode, op0_reg ),
  334.                    gen_rtx ( USE, VOIDmode, op1_reg ))));
  335.     DONE;
  336. }" )
  337.  
  338. ( define_insn ""
  339.   [ ( parallel [ ( clobber ( match_operand:PSI 0 "register_operand" "=A" ))
  340.          ( clobber ( match_operand:PSI 1 "register_operand" "=A" ))
  341.          ( use ( match_operand:SI 2 "immediate_operand" "i" ))
  342.          ( clobber ( match_operand:DI 3 "register_operand" "=*D*S" ))
  343.          ( set ( match_operand:BLK 4 "memory_operand" "" )
  344.                ( match_operand:BLK 5 "memory_operand" "" ))
  345.          ( use ( match_operand:PSI 6 "register_operand" "0" ))
  346.          ( use ( match_operand:PSI 7 "register_operand" "1" )) ] )
  347.   ]
  348. ""
  349. "*
  350. {
  351.     operands[8] = gen_label_rtx ( );
  352.  
  353.     if ( 'l' == memory_model )
  354.     {
  355.     if ( IS_SRC_OR_MPY_P ( REGNO ( operands[3] )))
  356.     {
  357.         return \"do    #%c2,%l8\;move    l:(%1)+,%m3\;move    %m3,l:(%0)+\\n%l8\";
  358.     }
  359.     else
  360.     {
  361.         return \"do    #%c2,%l8\;move    l:(%1)+,%o3\;move    %o3,l:(%0)+\\n%l8\";
  362.     }
  363.     }
  364.     else /* single mem space. */
  365.     {
  366.     RETURN_DSP ( \"do    #%c2,%l8\;move    @:(%1)+,%3\;move    %3,@:(%0)+\\n%l8\" );
  367.     }
  368. }" )
  369.  
  370. ;;
  371. ;;  ...........................................................................
  372. ;;
  373. ;;          ADDITIONS
  374. ;;
  375. ;;  ...........................................................................
  376. ;;
  377.  
  378. ;; We provide quick software emulation via a subroutine that emulates
  379. ;; a floating point instruction.
  380.  
  381. ( define_insn "adddf3"
  382.   [ ( set ( match_operand:DF 0 "general_operand" "=D" )
  383.           ( plus:DF ( match_operand:DF 1 "general_operand" "0" )
  384.                     ( match_operand:DF 2 "general_operand" "D" ))) 
  385.   ]
  386.   ""
  387.   "*
  388. {
  389.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  390.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  391.     
  392.     if ( op0_is_a )
  393.     {
  394.     if ( op2_is_a )
  395.     {
  396.         return \"jsr    fadd_aa\";
  397.     }
  398.     else
  399.     {
  400.         return \"jsr    fadd_ba\";
  401.     }
  402.     }
  403.     else
  404.     {
  405.     if ( op2_is_a )
  406.     {
  407.         return \"jsr    fadd_ab\";
  408.     }
  409.     else
  410.     {
  411.         return \"jsr    fadd_bb\";
  412.     }
  413.     }
  414. }" )    
  415.  
  416. ( define_insn "addsf3"
  417.   [ ( set ( match_operand:SF 0 "general_operand" "=D" )
  418.           ( plus:SF ( match_operand:SF 1 "general_operand" "0" )
  419.                     ( match_operand:SF 2 "general_operand" "D" ))) 
  420.   ]
  421.   ""
  422.   "*
  423. {
  424.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  425.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  426.     
  427.     if ( op0_is_a )
  428.     {
  429.     if ( op2_is_a )
  430.     {
  431.         return \"jsr    fadd_aa\";
  432.     }
  433.     else
  434.     {
  435.         return \"jsr    fadd_ba\";
  436.     }
  437.     }
  438.     else
  439.     {
  440.     if ( op2_is_a )
  441.     {
  442.         return \"jsr    fadd_ab\";
  443.     }
  444.     else
  445.     {
  446.         return \"jsr    fadd_bb\";
  447.     }
  448.     }
  449. }" )    
  450.  
  451. ;; Note that we MUST provide for inc/dec with a constant of one. The reload
  452. ;; pass may arbitrarily spill a regsiter post/pre inc/dec and will attempt to
  453. ;; perform the increment on the fly by itself. It does not consult the code
  454. ;; generator to see whether ( PSI <= PSI + CONST_INT ) is a valid insn.
  455.  
  456. ( define_insn "addpsi3"
  457.   [ ( set ( match_operand:PSI 0 "register_operand" "=*D,*A" )
  458.       ( plus:PSI 
  459.         ( match_operand:PSI 1 "register_operand" "0,0" )
  460.         ( match_operand:SI 2 "general_operand" "*D*S,i" )))
  461.   ]
  462.   ""
  463.   "*
  464. {
  465.     if ( which_alternative )
  466.     {
  467.     switch ( INTVAL ( operands[2] ))
  468.     {
  469.     case 0:
  470.         return \"\";
  471.         
  472.     case 1:
  473.         return \"move    (%0)+\";
  474.         
  475.     case -1:
  476.         return \"move    (%0)-\";
  477.         
  478.     default:
  479.         if ( load_n_reg_p ( operands[0], operands[2] ))
  480.         {
  481.         return \"move    #%p2,%j0\;move    (%0)+%j0\";
  482.         }
  483.         else
  484.         {
  485.         return \"move    (%0)+%j0\";
  486.         }
  487.     }
  488.     }
  489.     else
  490.     {
  491.     return \"add    %2,%0\";
  492.     }
  493. }" )
  494.  
  495. ;; we need this extra shape because addition commutes. 
  496.  
  497. ( define_insn ""
  498.   [ ( set ( match_operand:PSI 0 "register_operand" "=*D,*A" )
  499.       ( plus:PSI 
  500.         ( match_operand:SI 1 "general_operand" "*D*S,i" )
  501.         ( match_operand:PSI 2 "register_operand" "0,0" )))
  502.   ]
  503.   ""
  504.   "*
  505. {
  506.     if ( which_alternative )
  507.     {
  508.     switch ( INTVAL ( operands[2] ))
  509.     {
  510.     case 0:
  511.         return \"\";
  512.         
  513.     case 1:
  514.         return \"move    (%0)+\";
  515.         
  516.     case -1:
  517.         return \"move    (%0)-\";
  518.         
  519.     default:
  520.         if ( load_n_reg_p ( operands[0], operands[2] ))
  521.         {
  522.         return \"move    #%p1,%j0\;move    (%0)+%j0\";
  523.         }
  524.         else
  525.         {
  526.         return \"move    (%0)+%j0\";
  527.         }
  528.     }
  529.     }
  530.     else
  531.     {
  532.     return \"add    %1,%0\";
  533.     }
  534. }" )
  535.  
  536. ;; this insn is here because insn_extract does not detect commutable operands.
  537.  
  538. ( define_insn ""
  539.   [ ( set ( match_operand:PSI 0 "register_operand" "=*D" )
  540.       ( plus:PSI 
  541.         ( match_operand:SI 1 "register_operand" "*D*S" )
  542.         ( match_operand:PSI 2 "register_operand" "0" )))
  543.   ]
  544.   ""
  545.   "add    %1,%0" )
  546.  
  547. ( define_insn "addsi3"
  548.   [ ( set ( match_operand:SI 0 "register_operand" "=*D" )
  549.           ( plus:SI ( match_operand:SI 1 "register_operand" "0" )
  550.                     ( match_operand:SI 2 "register_operand" "*S*D" ))) 
  551.   ]
  552.   ""
  553.   "*
  554. {
  555.     if ( REGNO ( operands[2] ) == REGNO ( operands[0] ))
  556.     {
  557.     return \"asl    %0\";
  558.     }
  559.     else
  560.     {
  561.     return \"add    %2,%0\";
  562.     }
  563. }" )
  564.  
  565. ;;( define_insn ""
  566. ;;  [ ( set ( match_operand:SI 0 "register_operand" "=*D" )
  567. ;;     ( plus:SI ( match_operand:SI 1 "register_operand" "%0" )
  568. ;;               ( match_operand:PSI 2 "register_operand" "*S*D" ))) 
  569. ;;  ]
  570. ;;  ""
  571. ;;  "*
  572. ;;{
  573. ;;    if ( REGNO ( operands[2] ) == REGNO ( operands[0] ))
  574. ;;    {
  575. ;;    return \"asl    %0\";
  576. ;;    }
  577. ;;    else
  578. ;;    {
  579. ;;    return \"add    %2,%0\";
  580. ;;    }
  581. ;;}" )
  582.  
  583. ( define_insn "adddi3"
  584.   [ ( set ( match_operand:DI 0 "register_operand" "=*D" )
  585.           ( plus:DI ( match_operand:DI 1 "register_operand" "0" )
  586.                     ( match_operand:DI 2 "register_operand" "*S*D" ))) ]
  587.   ""
  588.   "*
  589. {
  590.     if ( IS_SRC_OR_MPY_P ( REGNO ( operands[2] )))
  591.     {
  592.     return \"add     %i2,%0\";
  593.     }
  594.     else
  595.     {
  596.     if ( REGNO ( operands[2] ) == REGNO ( operands[0] ))
  597.     {
  598.         return \"asl    %0\";
  599.     }
  600.     else
  601.     {
  602.         return \"add    %2,%0\";
  603.     }
  604.     }
  605. }" )
  606.  
  607. ;;
  608. ;;  ...........................................................................
  609. ;;
  610. ;;          SUBTRACTIONS
  611. ;;
  612. ;;  ...........................................................................
  613. ;;
  614.  
  615. ;; We provide quick software emulation via a subroutine that emulates
  616. ;; a floating point instruction.
  617.  
  618. ( define_insn "subdf3"
  619.   [ ( set ( match_operand:DF 0 "general_operand" "=D" )
  620.           ( minus:DF ( match_operand:DF 1 "general_operand" "0" )
  621.                      ( match_operand:DF 2 "general_operand" "D" ))) 
  622.   ]
  623.   ""
  624.   "*
  625. {
  626.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  627.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  628.     
  629.     if ( op0_is_a )
  630.     {
  631.     if ( op2_is_a )
  632.     {
  633.         return \"jsr    fsub_aa\";
  634.     }
  635.     else
  636.     {
  637.         return \"jsr    fsub_ba\";
  638.     }
  639.     }
  640.     else
  641.     {
  642.     if ( op2_is_a )
  643.     {
  644.         return \"jsr    fsub_ab\";
  645.     }
  646.     else
  647.     {
  648.         return \"jsr    fsub_bb\";
  649.     }
  650.     }
  651. }" )    
  652.  
  653. ( define_insn "subsf3"
  654.   [ ( set ( match_operand:SF 0 "general_operand" "=D" )
  655.           ( minus:SF ( match_operand:SF 1 "general_operand" "0" )
  656.                      ( match_operand:SF 2 "general_operand" "D" ))) 
  657.   ]
  658.   ""
  659.   "*
  660. {
  661.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  662.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  663.     
  664.     if ( op0_is_a )
  665.     {
  666.     if ( op2_is_a )
  667.     {
  668.         return \"jsr    fsub_aa\";
  669.     }
  670.     else
  671.     {
  672.         return \"jsr    fsub_ba\";
  673.     }
  674.     }
  675.     else
  676.     {
  677.     if ( op2_is_a )
  678.     {
  679.         return \"jsr    fsub_ab\";
  680.     }
  681.     else
  682.     {
  683.         return \"jsr    fsub_bb\";
  684.     }
  685.     }
  686. }" )    
  687.  
  688. ;; There are really two ways that subtraction can be used with pointers:
  689. ;; 1) PSI <= PSI - SI, and 2) SI <= PSI - PSI. Because of the way that the
  690. ;; GNU CC is structured in optabs.c, subtraction type (1) must be labeled as
  691. ;; subpsi3. Version 1.7 of optabs.c has code that, when turned on, will allow
  692. ;; you use type (2) as subpsi3. Currently, the shape for type (2) should
  693. ;; never be used: c-typeck.c converts the operands of a (2) to SImode before
  694. ;; the subtraction. This has no effect on us currently, however, if we should
  695. ;; try to use the address alu for PSImode adds and subtracts, it will.
  696.  
  697. ;; Addendum: the shape for (2) could actually be generated by the DSP loop
  698. ;; optimization code in computing the number of loop iterations.
  699.  
  700. ;; Note that we MUST provide for inc/dec with a constant of one. The reload
  701. ;; pass may arbitrarily spill a regsiter post/pre inc/dec and will attempt to
  702. ;; perform the increment on the fly by itself. It does not consult the code
  703. ;; generator to see whether ( PSI <= PSI + CONST_INT ) is a valid insn.
  704.  
  705. ( define_insn "subpsi3"
  706.   [ ( set ( match_operand:PSI 0 "register_operand" "=*D,*A" )
  707.       ( minus:PSI
  708.         ( match_operand:PSI 1 "register_operand" "0,0" )
  709.         ( match_operand:SI 2 "general_operand" "*D*S,i" )))
  710.   ]
  711.   ""
  712.   "*
  713. {
  714.     if ( which_alternative )
  715.     {
  716.     switch ( INTVAL ( operands[2] ))
  717.     {
  718.     case 0:
  719.         return \"\";
  720.         
  721.     case 1:
  722.         return \"move    (%0)-\";
  723.         
  724.     case -1:
  725.         return \"move    (%0)+\";
  726.         
  727.     default:
  728.         if ( load_n_reg_p ( operands[0], operands[2] ))
  729.         {
  730.         return \"move    #%p2,%j0\;move    (%0)-%j0\";
  731.         }
  732.         else
  733.         {
  734.         return \"move    (%0)-%j0\";
  735.         }
  736.     }
  737.     }
  738.     else
  739.     {
  740.     return \"sub    %2,%0\";
  741.     }
  742. }" )
  743.  
  744. ( define_insn ""
  745.   [ ( set ( match_operand:SI 0 "register_operand" "=*D" )
  746.       ( minus:PSI 
  747.         ( match_operand:PSI 1 "register_operand" "0" )
  748.         ( match_operand:PSI 2 "register_operand" "*D*S" )))
  749.   ]
  750.   ""
  751.   "sub    %2,%0" )
  752.  
  753. ( define_insn "subsi3"
  754.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  755.      ( minus:SI ( match_operand:SI 1 "register_operand" "0" )
  756.                 ( match_operand:SI 2 "register_operand" "*S*D" ))) ]
  757.   ""
  758.   "*
  759. {
  760.     if ( REGNO ( operands[2] ) == REGNO ( operands[0] ))
  761.     {
  762.     return \"clr    %0\";
  763.     }
  764.     else
  765.     {
  766.     return \"sub    %2,%0\";
  767.     }
  768. }" )
  769.  
  770. ( define_insn "subdi3"
  771.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  772.      ( minus:DI ( match_operand:DI 1 "register_operand" "0" )
  773.                 ( match_operand:DI 2 "register_operand" "*S*D" )))
  774.   ]
  775.   ""
  776.   "*
  777. {
  778.     if ( IS_SRC_OR_MPY_P ( REGNO ( operands[2] )))
  779.     {
  780.     return \"sub     %i2,%0\";
  781.     }
  782.     else
  783.     {
  784.     if ( REGNO ( operands[2] ) == REGNO ( operands[0] ))
  785.     {
  786.         return \"clr    %0\";
  787.     }
  788.     else
  789.     {
  790.         return \"sub    %2,%0\";
  791.     }
  792.     }
  793. }" )
  794.  
  795. ;;
  796. ;;  ...........................................................................
  797. ;;
  798. ;;          MULTIPLICATIONS AND DIVISIONS
  799. ;;
  800. ;;  ...........................................................................
  801. ;;
  802.  
  803. ;; We provide quick software emulation via a subroutine that emulates
  804. ;; a floating point instruction.
  805.  
  806. ( define_insn "muldf3"
  807.   [ ( set ( match_operand:DF 0 "general_operand" "=D" )
  808.           ( mult:DF ( match_operand:DF 1 "general_operand" "0" )
  809.                     ( match_operand:DF 2 "general_operand" "D" ))) 
  810.   ]
  811.   ""
  812.   "*
  813. {
  814.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  815.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  816.     
  817.     if ( op0_is_a )
  818.     {
  819.     if ( op2_is_a )
  820.     {
  821.         return \"jsr    fmpy_aa\";
  822.     }
  823.     else
  824.     {
  825.         return \"jsr    fmpy_ba\";
  826.     }
  827.     }
  828.     else
  829.     {
  830.     if ( op2_is_a )
  831.     {
  832.         return \"jsr    fmpy_ab\";
  833.     }
  834.     else
  835.     {
  836.         return \"jsr    fmpy_bb\";
  837.     }
  838.     }
  839. }" )    
  840.  
  841. ( define_insn "mulsf3"
  842.   [ ( set ( match_operand:SF 0 "general_operand" "=D" )
  843.           ( mult:SF ( match_operand:SF 1 "general_operand" "0" )
  844.                     ( match_operand:SF 2 "general_operand" "D" ))) 
  845.   ]
  846.   ""
  847.   "*
  848. {
  849.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  850.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  851.     
  852.     if ( op0_is_a )
  853.     {
  854.     if ( op2_is_a )
  855.     {
  856.         return \"jsr    fmpy_aa\";
  857.     }
  858.     else
  859.     {
  860.         return \"jsr    fmpy_ba\";
  861.     }
  862.     }
  863.     else
  864.     {
  865.     if ( op2_is_a )
  866.     {
  867.         return \"jsr    fmpy_ab\";
  868.     }
  869.     else
  870.     {
  871.         return \"jsr    fmpy_bb\";
  872.     }
  873.     }
  874. }" )    
  875.  
  876. ;; We have two shapes for mac+ and two shapes for mac-, because the mult may
  877. ;; turn up as either operand of the plus/minus.
  878.  
  879. ( define_insn ""
  880.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  881.       ( plus:SI ( match_operand:SI 1 "register_operand" "0" )
  882.             ( mult:SI ( match_operand:SI 2 "register_operand" "%S" )
  883.                   ( match_operand:SI 3 "register_operand" "R" ))))
  884.   ]
  885.   ""
  886.   "imac    %2,%3,%0" )
  887.  
  888. ( define_insn ""
  889.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  890.       ( plus:SI ( mult:SI ( match_operand:SI 1 "register_operand" "%S" )
  891.                   ( match_operand:SI 2 "register_operand" "R" ))
  892.             ( match_operand:SI 3 "register_operand" "0" )))
  893.   ]
  894.   ""
  895.   "imac    %1,%2,%0" )
  896.  
  897. ( define_insn ""
  898.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  899.       ( minus:SI ( match_operand:SI 1 "register_operand" "0" )
  900.              ( mult:SI ( match_operand:SI 2 "register_operand" "%S" )
  901.                    ( match_operand:SI 3 "register_operand" "R" ))))
  902.   ]
  903.   ""
  904.   "neg    %0;imac    %2,%3,%0;neg    %0"
  905.  
  906. ;; we have a quick (breaks calling convention rules) subr. act as an inst.
  907.  
  908. ( define_insn "muldi3"
  909.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  910.           ( mult:DI ( match_operand:DI 1 "register_operand" "0" )
  911.                     ( match_operand:DI 2 "register_operand" "D" ))) 
  912.   ]
  913.   ""
  914.   "*
  915. {
  916.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  917.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  918.     
  919.     if ( op0_is_a )
  920.     {
  921.     if ( op2_is_a )
  922.     {
  923.         return \"jsr    lmpy_aa\";
  924.     }
  925.     else
  926.     {
  927.         return \"jsr    lmpy_ba\";
  928.     }
  929.     }
  930.     else
  931.     {
  932.     if ( op2_is_a )
  933.     {
  934.         return \"jsr    lmpy_ab\";
  935.     }
  936.     else
  937.     {
  938.         return \"jsr    lmpy_bb\";
  939.     }
  940.     }
  941. }" )    
  942.  
  943.  
  944. ;; normal, boring mults follow.
  945.  
  946. ( define_insn "mulsi3"
  947.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  948.       ( mult:SI ( match_operand:SI 1 "register_operand" "%S" )
  949.             ( match_operand:SI 2 "register_operand" "R" ))) 
  950.   ]
  951.   ""
  952.   "impy    %2,%1,%0" )
  953.  
  954. ( define_insn "umulsi3"
  955.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  956.       ( umult:SI ( match_operand:SI 1 "register_operand" "%S" )
  957.              ( match_operand:SI 2 "register_operand" "R" )))
  958.   ]
  959.   ""
  960.   "impy    %2,%1,%0" )
  961.  
  962. ;; We provide quick software emulation via a subroutine that emulates
  963. ;; a floating point instruction.
  964.  
  965. ( define_insn "divdi3"
  966.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  967.           ( div:DI ( match_operand:DI 1 "register_operand" "0" )
  968.                    ( match_operand:DI 2 "register_operand" "D" ))) 
  969.   ]
  970.   ""
  971.   "*
  972. {
  973.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  974.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  975.     
  976.     if ( op0_is_a )
  977.     {
  978.     if ( op2_is_a )
  979.     {
  980.         return \"jsr    ldiv_aa\";
  981.     }
  982.     else
  983.     {
  984.         return \"jsr    ldiv_ba\";
  985.     }
  986.     }
  987.     else
  988.     {
  989.     if ( op2_is_a )
  990.     {
  991.         return \"jsr    ldiv_ab\";
  992.     }
  993.     else
  994.     {
  995.         return \"jsr    ldiv_bb\";
  996.     }
  997.     }
  998. }" )    
  999.  
  1000. ( define_insn "divdf3"
  1001.   [ ( set ( match_operand:DF 0 "general_operand" "=D" )
  1002.           ( div:DF ( match_operand:DF 1 "general_operand" "0" )
  1003.                    ( match_operand:DF 2 "general_operand" "D" ))) 
  1004.   ]
  1005.   ""
  1006.   "*
  1007. {
  1008.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  1009.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  1010.     
  1011.     if ( op0_is_a )
  1012.     {
  1013.     if ( op2_is_a )
  1014.     {
  1015.         return \"jsr    fdiv_aa\";
  1016.     }
  1017.     else
  1018.     {
  1019.         return \"jsr    fdiv_ba\";
  1020.     }
  1021.     }
  1022.     else
  1023.     {
  1024.     if ( op2_is_a )
  1025.     {
  1026.         return \"jsr    fdiv_ab\";
  1027.     }
  1028.     else
  1029.     {
  1030.         return \"jsr    fdiv_bb\";
  1031.     }
  1032.     }
  1033. }" )    
  1034.  
  1035. ( define_insn "divsf3"
  1036.   [ ( set ( match_operand:SF 0 "general_operand" "=D" )
  1037.           ( div:SF ( match_operand:SF 1 "general_operand" "0" )
  1038.                    ( match_operand:SF 2 "general_operand" "D" ))) 
  1039.   ]
  1040.   ""
  1041.   "*
  1042. {
  1043.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  1044.     int op2_is_a = ( DSP16_A_REGNUM == REGNO ( operands[2] ));
  1045.     
  1046.     if ( op0_is_a )
  1047.     {
  1048.     if ( op2_is_a )
  1049.     {
  1050.         return \"jsr    fdiv_aa\";
  1051.     }
  1052.     else
  1053.     {
  1054.         return \"jsr    fdiv_ba\";
  1055.     }
  1056.     }
  1057.     else
  1058.     {
  1059.     if ( op2_is_a )
  1060.     {
  1061.         return \"jsr    fdiv_ab\";
  1062.     }
  1063.     else
  1064.     {
  1065.         return \"jsr    fdiv_bb\";
  1066.     }
  1067.     }
  1068. }" )    
  1069.  
  1070. ( define_expand "divsi3"
  1071.   [ ( set ( match_operand:SI 0 "register_operand" "" )
  1072.       ( div:SI ( match_operand:SI 1 "register_operand" "" )
  1073.            ( match_operand:SI 2 "register_operand" "" )))
  1074.   ]
  1075.   ""
  1076.   "
  1077. {
  1078.     emit_insn (
  1079.            gen_rtx ( PARALLEL, VOIDmode,
  1080.             gen_rtvec ( 3,
  1081.                    gen_rtx ( SET, VOIDmode, operands[0],
  1082.                         gen_rtx ( DIV, SImode, 
  1083.                              operands[1],
  1084.                              operands[2] )),
  1085.                    gen_rtx ( CLOBBER, VOIDmode, 
  1086.                         gen_reg_rtx ( SImode )),
  1087.                    gen_rtx ( CLOBBER, VOIDmode, 
  1088.                         gen_reg_rtx ( SImode )))));
  1089.     DONE;
  1090. }" )
  1091.  
  1092. ( define_insn ""
  1093.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1094.                ( div:SI ( match_operand:SI 1 "register_operand" "0" )
  1095.                 ( match_operand:SI 2 "register_operand" "S" )))
  1096.          ( clobber ( match_operand:SI 3 "register_operand" "=D" ))
  1097.          ( clobber ( match_operand:SI 4 "register_operand" "=S" )) ] )
  1098.   ]
  1099.   ""
  1100.   "*
  1101. {
  1102.     operands[5] = gen_label_rtx ( );
  1103.     
  1104.     return  \"tfr    %0,%3\;abs    %0\;clr    %0    %e0,%4\;move    %4,%h0\;asl    %0\;rep    #$10\;div    %2,%0\;eor    %2,%3\;jpl    %l5\;neg    %0\\n%l5\;move    %h0,%0\";
  1105.  
  1106. }" )
  1107.  
  1108. ;;
  1109. ;;  ...........................................................................
  1110. ;;
  1111. ;;          NEGATIONS
  1112. ;;
  1113. ;;  ...........................................................................
  1114. ;;
  1115.  
  1116. ;; We provide quick software emulation via a subroutine that emulates
  1117. ;; a floating point instruction.
  1118.  
  1119. ( define_insn "negdf2"
  1120.   [ ( set ( match_operand:DF 0 "general_operand" "=D" )
  1121.           ( neg:DF ( match_operand:DF 1 "general_operand" "0" )))
  1122.   ]
  1123.   ""
  1124.   "*
  1125. {
  1126.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  1127.     {
  1128.     return \"jsr    fneg_a\";
  1129.     }
  1130.     else
  1131.     {
  1132.     return \"jsr    fneg_b\";
  1133.     }
  1134. }" )    
  1135.  
  1136. ( define_insn "negsf2"
  1137.   [ ( set ( match_operand:SF 0 "general_operand" "=D" )
  1138.           ( neg:SF ( match_operand:SF 1 "general_operand" "0" )))
  1139.   ]
  1140.   ""
  1141.   "*
  1142. {
  1143.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  1144.     {
  1145.     return \"jsr    fneg_a\";
  1146.     }
  1147.     else
  1148.     {
  1149.     return \"jsr    fneg_b\";
  1150.     }
  1151. }" )    
  1152.  
  1153. ( define_insn "negsi2"
  1154.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1155.       ( neg:SI ( match_operand:SI 1 "register_operand" "0" )))
  1156.   ]
  1157.   ""
  1158.   "neg    %0" )
  1159.  
  1160. ( define_insn "negdi2"
  1161.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1162.       ( neg:DI ( match_operand:DI 1 "register_operand" "0" )))
  1163.   ]
  1164.   ""
  1165.   "neg    %0" )
  1166.  
  1167. ;;
  1168. ;;  ...........................................................................
  1169. ;;
  1170. ;;          ABSOLUTE VALUES
  1171. ;;
  1172. ;;  ...........................................................................
  1173. ;;
  1174.  
  1175. ( define_insn "abssi2"
  1176.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1177.       ( abs:SI ( match_operand:SI 1 "register_operand" "0" ) ) ) ]
  1178.   ""
  1179.   "abs    %0" )
  1180.  
  1181. ( define_insn "absdi2"
  1182.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1183.       ( abs:DI ( match_operand:DI 1 "register_operand" "0" ) ) ) ]
  1184.   ""
  1185.   "abs    %0" )
  1186.  
  1187. ;;
  1188. ;;  ...........................................................................
  1189. ;;
  1190. ;;          LOGICAL AND
  1191. ;;
  1192. ;;  ...........................................................................
  1193. ;;
  1194.  
  1195. ( define_insn "andsi3"
  1196.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1197.       ( and:SI ( match_operand:SI 1 "register_operand" "0" )
  1198.            ( match_operand:SI 2 "register_operand" "S" ) ) ) ]
  1199.   ""
  1200.   "and    %2,%0\;move    %e0,%0" )
  1201.  
  1202. ( define_insn "anddi3"
  1203.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1204.       ( and:DI ( match_operand:DI 1 "register_operand" "0" )
  1205.            ( match_operand:DI 2 "register_operand" "S" ) ) ) ]
  1206.   ""
  1207.   "*
  1208. {
  1209.     RETURN_DSP ( \"and    %g2,%0    %h0,@:(r6)\;move    %e0,%h0\;move    @:(r6),%e0\;and    %2,%0\;move    %e0,@:(r6)\;move    %h0,%0\;move    @:(r6),%h0\" );
  1210. }" )
  1211.  
  1212. ;;
  1213. ;;  ...........................................................................
  1214. ;;
  1215. ;;          LOGICAL INCLUSIVE OR
  1216. ;;
  1217. ;;  ...........................................................................
  1218. ;;
  1219.  
  1220. ( define_insn "iorsi3"
  1221.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1222.       ( ior:SI ( match_operand:SI 1 "register_operand" "0" )
  1223.            ( match_operand:SI 2 "register_operand" "S" ) ) ) ]
  1224.   ""
  1225.   "or    %2,%0\;move    %e0,%0" )
  1226.  
  1227. ( define_insn "iordi3"
  1228.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1229.       ( ior:DI ( match_operand:DI 1 "register_operand" "0" )
  1230.            ( match_operand:DI 2 "register_operand" "S" ) ) ) ]
  1231.   ""
  1232.   "*
  1233. {
  1234.     RETURN_DSP ( \"or    %g2,%0    %h0,@:(r6)\;move    %e0,%h0\;move    @:(r6),%e0\;or    %2,%0\;move    %e0,@:(r6)\;move    %h0,%0\;move    @:(r6),%h0\" );
  1235. }" )
  1236.  
  1237. ;;
  1238. ;;  ...........................................................................
  1239. ;;
  1240. ;;          LOGICAL EXCLUSIVE OR
  1241. ;;
  1242. ;;  ...........................................................................
  1243. ;;
  1244.  
  1245. ( define_insn "xorsi3"
  1246.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1247.       ( xor:SI ( match_operand:SI 1 "register_operand" "0" )
  1248.            ( match_operand:SI 2 "register_operand" "S" ) ) ) ]
  1249.   ""
  1250.   "eor    %2,%0\;move    %e0,%0" )
  1251.  
  1252. ( define_insn "xordi3"
  1253.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1254.       ( xor:DI ( match_operand:DI 1 "register_operand" "0" )
  1255.            ( match_operand:DI 2 "register_operand" "S" ) ) ) ]
  1256.   ""
  1257.   "*
  1258. {
  1259.     RETURN_DSP ( \"eor    %g2,%0    %h0,@:(r6)\;move    %e0,%h0\;move    @:(r6),%e0\;eor    %2,%0\;move    %e0,@:(r6)\;move    %h0,%0\;move    @:(r6),%h0\" );
  1260. }" )
  1261.  
  1262. ;;
  1263. ;;  ...........................................................................
  1264. ;;
  1265. ;;          ONE'S COMPLEMENT
  1266. ;;
  1267. ;;  ...........................................................................
  1268. ;;
  1269.  
  1270. ( define_insn "one_cmplsi2"
  1271.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1272.       ( not:SI ( match_operand:SI 1 "register_operand" "0" ))) 
  1273.   ]
  1274.   ""
  1275.   "not    %0\;move    %e0,%0" )
  1276.  
  1277. ( define_insn "one_cmpldi2"
  1278.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1279.       ( not:DI ( match_operand:DI 1 "register_operand" "0" )))
  1280.   ]
  1281.   ""
  1282.   "*
  1283. {
  1284.     RETURN_DSP ( \"not    %0    %h0,@:(r6)\;move    %e0,%h0\;move    @:(r6),%e0\;not    %0\;move    %e0,@:(r6)\;move    %h0,%0\;move    @:(r6),%h0\" );
  1285. }" )
  1286.  
  1287. ;;
  1288. ;;  ...........................................................................
  1289. ;;
  1290. ;;          ARITHMETIC SHIFTS
  1291. ;;
  1292. ;;  ...........................................................................
  1293. ;;
  1294.  
  1295. ;; note that we preceed each shift insn by an unnamed insn. the unnamed insn
  1296. ;; is used to catch shifts with constant shift counts before said constants
  1297. ;; are promoted to registers. 
  1298.  
  1299. ( define_insn ""
  1300.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1301.       ( ashift:SI ( match_operand:SI 1 "register_operand" "0" )
  1302.               ( match_operand:SI 2 "immediate_operand" "i" )))
  1303.   ]
  1304.   ""
  1305.   "*
  1306. {
  1307.     if ( 1 == INTVAL ( operands[2] ))
  1308.     {
  1309.     return \"asl    %0\;move    %e0,%0\";
  1310.     }
  1311.     else if ( 2 == INTVAL ( operands[2] ))
  1312.     {
  1313.     return \"asl    %0\;asl    %0\;move    %e0,%0\";
  1314.     }
  1315.     else
  1316.     {
  1317.     operands[3] = copy_rtx ( operands[2] );
  1318.     INTVAL ( operands[3] ) &= 0xfff;
  1319.         
  1320.     if ( TARGET_REP )
  1321.     {
  1322.         return \"rep    #%c3\;asl    %0\;move    %e0,%0\";
  1323.     }
  1324.     else
  1325.     {
  1326.         operands[4] = gen_label_rtx ( );
  1327.         
  1328.         return \"do    #%c3,%l4\;asl    %0\\n%l4\;move    %e0,%0\";
  1329.     }
  1330.     }
  1331. }" )
  1332.  
  1333. ( define_insn "ashlsi3"
  1334.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1335.       ( ashift:SI ( match_operand:SI 1 "register_operand" "0" )
  1336.               ( match_operand:SI 2 "general_operand" "D" )))
  1337.   ]
  1338.   ""
  1339.   "*
  1340. {
  1341.     operands[3] = gen_label_rtx ( );
  1342.     
  1343.     if ( TARGET_REP )
  1344.     {
  1345.     return \"tst    %2\;jeq    %l3\;rep    %2\;asl    %0\;move    %e0,%0\\n%l3\";
  1346.     }
  1347.     else
  1348.     {
  1349.     operands[4] = gen_label_rtx ( );
  1350.     
  1351.     return \"tst    %2\;jeq    %l3\;do    %2,%l4\;asl    %0\\n%l4\;move    %e0,%0\\n%l3\";
  1352.     }
  1353. }")
  1354.  
  1355. ( define_insn ""
  1356.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1357.       ( ashiftrt:SI ( match_operand:SI 1 "register_operand" "0" )
  1358.             ( match_operand:SI 2 "immediate_operand" "i" )))
  1359.   ]
  1360.   ""
  1361.   "*
  1362. {
  1363.     if ( 1 == INTVAL ( operands[2] ))
  1364.     {
  1365.     return \"move    %e0,%0\;asr    %0\;move    %e0,%0\";
  1366.     }
  1367.     else if ( 2 == INTVAL ( operands[2] ))
  1368.     {
  1369.     return \"move    %e0,%0\;asr    %0\;asr    %0\;move    %e0,%0\";
  1370.     }
  1371.     else
  1372.     {
  1373.     operands[3] = copy_rtx ( operands[2] );
  1374.     INTVAL ( operands[3] ) &= 0xfff;
  1375.     
  1376.     if ( TARGET_REP )
  1377.     {
  1378.         return \"move    %e0,%0\;rep    #%c3\;asr    %0\;move    %e0,%0\";
  1379.     }
  1380.     else
  1381.     {
  1382.         operands[4] = gen_label_rtx ( );
  1383.         
  1384.         return \"move    %e0,%0\;do    #%c3,%l4\;asr    %0\\n%l4\;move    %e0,%0\";
  1385.     }
  1386.     }
  1387. }" )
  1388.  
  1389. ( define_insn "ashrsi3"
  1390.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1391.      ( ashiftrt:SI ( match_operand:SI 1 "register_operand" "0" )
  1392.                    ( match_operand:SI 2 "general_operand" "D" )))
  1393.   ]
  1394.   ""
  1395.   "*
  1396. {
  1397.     operands[3] = gen_label_rtx ( );
  1398.     
  1399.     if ( TARGET_REP )
  1400.     {
  1401.     return \"tst    %2\;jeq    %l3\;move    %e0,%0\;rep    %2\;asr    %0\;move    %e0,%0\\n%l3\";
  1402.     }
  1403.     else
  1404.     {
  1405.     operands[4] = gen_label_rtx ( );
  1406.     
  1407.     return \"tst    %2\;jeq    %l3\;move    %e0,%0\;do    %2,%l4\;asr    %0\\n%l4\;move    %e0,%0\\n%l3\";
  1408.     }
  1409. }")
  1410.  
  1411. ( define_insn ""
  1412.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1413.      ( ashift:DI ( match_operand:DI 1 "register_operand" "0" )
  1414.                  ( match_operand:SI 2 "immediate_operand" "i" )))
  1415.   ]
  1416.   ""
  1417.   "*
  1418. {
  1419.     if ( 1 == INTVAL ( operands[2] ))
  1420.     {
  1421.     return \"asl    %0\";
  1422.     }
  1423.     else if ( 2 == INTVAL ( operands[2] ))
  1424.     {
  1425.     return \"asl    %0\;asl    %0\";
  1426.     }
  1427.     else
  1428.     {
  1429.     operands[3] = copy_rtx ( operands[2] );
  1430.     INTVAL ( operands[3] ) &= 0xfff;
  1431.     
  1432.     if ( TARGET_REP )
  1433.     {
  1434.         return \"rep    #%c3\;asl    %0\";
  1435.     }
  1436.     else
  1437.     {
  1438.         operands[4] = gen_label_rtx ( );
  1439.         
  1440.         return \"do    #%c3,%l4\;asl    %0\\n%l4\";
  1441.     }
  1442.     }
  1443. }" )
  1444.  
  1445. ( define_insn "ashldi3"
  1446.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1447.      ( ashift:DI ( match_operand:DI 1 "register_operand" "0" )
  1448.                  ( match_operand:SI 2 "general_operand" "D" )))
  1449.   ]
  1450.   ""
  1451.   "*
  1452. {
  1453.     operands[3] = gen_label_rtx ( );
  1454.     
  1455.     if ( TARGET_REP )
  1456.     {
  1457.     return \"tst    %d2\;jeq    %l3\;rep    %2\;asl    %0\\n%l3\";
  1458.     }
  1459.     else
  1460.     {
  1461.     return \"tst    %d2\;jeq    %l3\;do    %2,%l3\;asl    %0\\n%l3\";
  1462.     }
  1463. }")
  1464.  
  1465. ( define_insn ""
  1466.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1467.      ( ashiftrt:DI ( match_operand:DI 1 "register_operand" "0" )
  1468.                    ( match_operand:SI 2 "immediate_operand" "i" )))
  1469.   ]
  1470.   ""
  1471.   "*
  1472. {
  1473.     if ( 1 == INTVAL ( operands[2] ))
  1474.     {
  1475.     RETURN_DSP ( \"move    %h0,@:(r6)\;move    %e0,%0\;move    @:(r6),%h0\;asr    %0\" );
  1476.     }
  1477.     else if ( 2 == INTVAL ( operands[2] ))
  1478.     {
  1479.     RETURN_DSP ( \"move    %h0,@:(r6)\;move    %e0,%0\;move    @:(r6),%h0\;asl    %0\;asr    %0\" );
  1480.     }
  1481.     else
  1482.     {
  1483.     operands[3] = copy_rtx ( operands[2] );
  1484.     INTVAL ( operands[3] ) &= 0xfff;
  1485.     
  1486.     if ( TARGET_REP )
  1487.     {
  1488.         RETURN_DSP ( \"move    %h0,@:(r6)\;move    %e0,%0\;move    @:(r6),%h0\;rep    #%c3\;asr    %0\" );
  1489.     }
  1490.     else
  1491.     {
  1492.         operands[4] = gen_label_rtx ( );
  1493.         
  1494.         RETURN_DSP ( \"move    %h0,@:(r6)\;move    %e0,%0\;move    @:(r6),%h0\;do    #%c3,%l4\;asr    %0\\n%l4\" );
  1495.     }
  1496.     }
  1497. }" )
  1498.  
  1499. ( define_insn "ashrdi3"
  1500.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1501.      ( ashiftrt:DI ( match_operand:DI 1 "register_operand" "0" )
  1502.                    ( match_operand:SI 2 "general_operand" "D" )))
  1503.   ]
  1504.   ""
  1505.   "*
  1506. {
  1507.     operands[3] = gen_label_rtx ( );
  1508.  
  1509.     if ( TARGET_REP )
  1510.     {
  1511.     RETURN_DSP ( \"move    %h0,@:(r6)\;move    %e0,%0\;move    @:(r6),%h0\;tst    %d2\;jeq    %l3\;rep    %2\;asr    %0\\n%l3\" );
  1512.     }
  1513.     else
  1514.     {
  1515.     RETURN_DSP ( \"move    %h0,@:(r6)\;move    %e0,%0\;move    @:(r6),%h0\;tst    %d2\;jeq    %l3\;do    %2,%l3\;asr    %0\\n%l3\" );
  1516.     }
  1517. }")
  1518.  
  1519. ;;
  1520. ;;  ...........................................................................
  1521. ;;
  1522. ;;          LOGICAL SHIFTS
  1523. ;;
  1524. ;;  ...........................................................................
  1525. ;;
  1526.  
  1527. ;; note that we preceed each shift insn by an unnamed insn. the unnamed insn
  1528. ;; is used to catch shifts with constant shift counts before said constants
  1529. ;; are promoted to registers. 
  1530.  
  1531. ( define_insn ""
  1532.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1533.      ( lshift:SI ( match_operand:SI 1 "register_operand" "0" )
  1534.                  ( match_operand:SI 2 "immediate_operand" "i" )))
  1535.   ]
  1536.   ""
  1537.   "*
  1538. {
  1539.     if ( 1 == INTVAL ( operands[2] ))
  1540.     {
  1541.     return \"lsl    %0\";
  1542.     }
  1543.     else if ( 2 == INTVAL ( operands[2] ))
  1544.     {
  1545.     return \"lsl    %0\;lsl    %0\";
  1546.     }
  1547.     else
  1548.     {
  1549.     operands[3] = copy_rtx ( operands[2] );
  1550.     INTVAL ( operands[3] ) &= 0xfff;
  1551.     
  1552.     if ( TARGET_REP )
  1553.     {
  1554.         return \"rep    #%c3\;lsl    %0\";
  1555.     }
  1556.     else
  1557.     {
  1558.         operands[4] = gen_label_rtx ( );
  1559.         
  1560.         return \"do    #%c3,%l4\;lsl    %0\\n%l4\";
  1561.     }
  1562.     }
  1563. }" )
  1564.  
  1565. ( define_insn "lshlsi3"
  1566.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1567.      ( lshift:SI ( match_operand:SI 1 "register_operand" "0" )
  1568.                  ( match_operand:SI 2 "general_operand" "D" )))
  1569.   ]
  1570.   ""
  1571.   "*
  1572. {
  1573.     operands[3] = gen_label_rtx ( );
  1574.     
  1575.     if ( TARGET_REP )
  1576.     {
  1577.     return \"tst    %2\;jeq    %l3\;rep    %2\;lsl    %0\\n%l3\";
  1578.     }
  1579.     else
  1580.     {
  1581.     return \"tst    %2\;jeq    %l3\;do    %2,%l3\;lsl    %0\\n%l3\";
  1582.     }
  1583. }")
  1584.  
  1585. ( define_insn ""
  1586.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1587.      ( lshiftrt:SI ( match_operand:SI 1 "register_operand" "0" )
  1588.                    ( match_operand:SI 2 "immediate_operand" "i" )))
  1589.   ]
  1590.   ""
  1591.   "*
  1592. {
  1593.     if ( 1 == INTVAL ( operands[2] ))
  1594.     {
  1595.     return \"lsr    %0\";
  1596.     }
  1597.     else if ( 2 == INTVAL ( operands[2] ))
  1598.     {
  1599.     return \"lsr    %0\;lsr    %0\";
  1600.     }
  1601.     else
  1602.     {
  1603.     operands[3] = copy_rtx ( operands[2] );
  1604.     INTVAL ( operands[3] ) &= 0xfff;
  1605.     
  1606.     if ( TARGET_REP )
  1607.     {
  1608.         return \"rep    #%c3\;lsr    %0\";
  1609.     }
  1610.     else
  1611.     {
  1612.         operands[4] = gen_label_rtx ( );
  1613.         
  1614.         return \"do    #%c3,%l4\;lsr    %0\\n%l4\";
  1615.     }
  1616.     }
  1617. }" )
  1618.  
  1619. ( define_insn "lshrsi3"
  1620.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1621.      ( lshiftrt:SI ( match_operand:SI 1 "register_operand" "0" )
  1622.                    ( match_operand:SI 2 "general_operand" "D" )))
  1623.   ]
  1624.   ""
  1625.   "*
  1626. {
  1627.     operands[3] = gen_label_rtx ( );
  1628.     
  1629.     if ( TARGET_REP )
  1630.     {
  1631.     return \"tst    %2\;jeq    %l3\;rep    %2\;lsr    %0\\n%l3\";
  1632.     }
  1633.     else
  1634.     {
  1635.     return \"tst    %2\;jeq    %l3\;do    %2,%l3\;lsr    %0\\n%l3\";
  1636.     }
  1637. }")
  1638.  
  1639. ( define_insn ""
  1640.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1641.      ( lshift:DI ( match_operand:DI 1 "register_operand" "0" )
  1642.                  ( match_operand:SI 2 "immediate_operand" "i" )))
  1643.   ]
  1644.   ""
  1645.   "*
  1646. {
  1647.     if ( 1 == INTVAL ( operands[2] ))
  1648.     {
  1649.     return \"asl    %0\";
  1650.     }
  1651.     else if ( 2 == INTVAL ( operands[2] ))
  1652.     {
  1653.     return \"asl    %0\;asl    %0\";
  1654.     }
  1655.     else
  1656.     {
  1657.     operands[3] = copy_rtx ( operands[2] );
  1658.     INTVAL ( operands[3] ) &= 0xfff;
  1659.     
  1660.     if ( TARGET_REP )
  1661.     {
  1662.         return \"rep    #%c3\;asl    %0\";
  1663.     }
  1664.     else
  1665.     {    
  1666.         operands[4] = gen_label_rtx ( );
  1667.         
  1668.         return \"do    #%c3,%l4\;asl    %0\\n%l4\";
  1669.     }
  1670.     }
  1671. }" )
  1672.  
  1673. ( define_insn "lshldi3"
  1674.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1675.      ( lshift:DI ( match_operand:DI 1 "register_operand" "0" )
  1676.                  ( match_operand:SI 2 "general_operand" "D" )))
  1677.   ]
  1678.   ""
  1679.   "*
  1680. {
  1681.     operands[3] = gen_label_rtx ( );
  1682.  
  1683.     if ( TARGET_REP )
  1684.     {
  1685.     return \"tst    %d2\;jeq    %l3\;rep    %2\;asl    %0\\n%l3\";
  1686.     }
  1687.     else
  1688.     {
  1689.     return \"tst    %d2\;jeq    %l3\;do    %2,%l3\;asl    %0\\n%l3\";
  1690.     }
  1691. }")
  1692.  
  1693. ( define_insn ""
  1694.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1695.      ( lshiftrt:DI ( match_operand:DI 1 "register_operand" "0" )
  1696.                    ( match_operand:SI 2 "immediate_operand" "i" )))
  1697.   ]
  1698.   ""
  1699.   "*
  1700. {
  1701.     if ( 1 == INTVAL ( operands[2] ))
  1702.     {
  1703.     return \"move    #0,%k0\;asr    %0\";
  1704.     }
  1705.     else if ( 2 == INTVAL ( operands[2] ))
  1706.     {
  1707.     return \"move    #0,%k0\;asr    %0\;asr    %0\";
  1708.     }
  1709.     else
  1710.     {
  1711.     operands[3] = copy_rtx ( operands[2] );
  1712.     INTVAL ( operands[3] ) &= 0xfff;
  1713.     
  1714.     if ( TARGET_REP )
  1715.     {
  1716.         return \"move    #0,%k0\;rep    #%c3\;asr    %0\";
  1717.     }
  1718.     else
  1719.     {
  1720.         operands[4] = gen_label_rtx ( );
  1721.         
  1722.         return \"move    #0,%k0\;do    #%c3,%l4\;asr    %0\\n%l4\";
  1723.     }
  1724.     }
  1725. }" )
  1726.  
  1727. ( define_insn "lshrdi3"
  1728.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  1729.      ( lshiftrt:DI ( match_operand:DI 1 "register_operand" "0" )
  1730.                    ( match_operand:SI 2 "general_operand" "D" )))
  1731.   ]
  1732.   ""
  1733.   "*
  1734. {
  1735.     operands[3] = gen_label_rtx ( );
  1736.     
  1737.     if ( TARGET_REP )
  1738.     {
  1739.     return \"tst    %d2\;jeq    %l3\;move    #0,%k0\;rep    %2\;asr    %0\\n%l3\";
  1740.     }
  1741.     else
  1742.     {
  1743.     return \"tst    %d2\;jeq    %l3\;move    #0,%k0\;do    %2,%l3\;asr    %0\\n%l3\";
  1744.     }
  1745. }")
  1746.  
  1747. ;;
  1748. ;;  ...........................................................................
  1749. ;;
  1750. ;;          ROTATIONS
  1751. ;;
  1752. ;;  ...........................................................................
  1753. ;;
  1754.  
  1755. ;; note that we preceed each shift insn by an unnamed insn. the unnamed insn
  1756. ;; is used to catch shifts with constant shift counts before said constants
  1757. ;; are promoted to registers. 
  1758.  
  1759. ( define_insn ""
  1760.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1761.      ( rotate:SI ( match_operand:SI 1 "register_operand" "0" )
  1762.                  ( match_operand:SI 2 "immediate_operand" "i" )))
  1763.   ]
  1764.   ""
  1765.   "*
  1766. {
  1767.     if ( 1 == INTVAL ( operands[2] ))
  1768.     {
  1769.     return \"rol    %0\";
  1770.     }
  1771.     else if ( 2 == INTVAL ( operands[2] ))
  1772.     {
  1773.     return \"rol    %0\;rol    %0\";
  1774.     }
  1775.     else
  1776.     {
  1777.     operands[3] = copy_rtx ( operands[2] );
  1778.     INTVAL ( operands[3] ) &= 0xfff;
  1779.     
  1780.     if ( TARGET_REP )
  1781.     {
  1782.         return \"rep    #%c3\;rol    %0\";
  1783.     }
  1784.     else
  1785.     {
  1786.         operands[4] = gen_label_rtx ( );
  1787.         
  1788.         return \"do    #%c3,%l4\;rol    %0\\n%l4\";
  1789.     }
  1790.     }
  1791. }" )
  1792.  
  1793. ( define_insn "rotlsi3"
  1794.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1795.      ( rotate:SI ( match_operand:SI 1 "register_operand" "0" )
  1796.                  ( match_operand:SI 2 "general_operand" "D" )))
  1797.   ]
  1798.   ""
  1799.   "*
  1800. {
  1801.     operands[3] = gen_label_rtx ( );
  1802.     
  1803.     if ( TARGET_REP )
  1804.     {
  1805.     return \"tst    %2\;jeq    %l3\;rep    %2\;rol    %0\\n%l3\";
  1806.     }
  1807.     else
  1808.     {
  1809.     return \"tst    %2\;jeq    %l3\;do    %2,%l3\;rol    %0\\n%l3\";
  1810.     }
  1811. }")
  1812.  
  1813. ( define_insn ""
  1814.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1815.      ( rotatert:SI ( match_operand:SI 1 "register_operand" "0" )
  1816.                    ( match_operand:SI 2 "immediate_operand" "i" )))
  1817.   ]
  1818.   ""
  1819.   "*
  1820. {
  1821.     if ( 1 == INTVAL ( operands[2] ))
  1822.     {
  1823.     return \"ror    %0\";
  1824.     }
  1825.     else if ( 2 == INTVAL ( operands[2] ))
  1826.     {
  1827.     return \"ror    %0\;ror    %0\";
  1828.     }
  1829.     else
  1830.     {
  1831.     operands[3] = copy_rtx ( operands[2] );
  1832.     INTVAL ( operands[3] ) &= 0xfff;
  1833.     
  1834.     if ( TARGET_REP )
  1835.     {
  1836.         return \"rep    #%c3\;ror    %0\";
  1837.     }
  1838.     else
  1839.     {
  1840.         operands[4] = gen_label_rtx ( );
  1841.         
  1842.         return \"do    #%c3,%l4\;ror    %0\\n%l4\";
  1843.     }
  1844.     }
  1845. }" )
  1846.  
  1847. ( define_insn "rotrsi3"
  1848.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  1849.      ( rotatert:SI ( match_operand:SI 1 "register_operand" "0" )
  1850.                    ( match_operand:SI 2 "general_operand" "D" )))
  1851.   ]
  1852.   ""
  1853.   "*
  1854. {
  1855.     operands[3] = gen_label_rtx ( );
  1856.     
  1857.     if ( TARGET_REP )
  1858.     {
  1859.     return \"tst    %2\;jeq    %l3\;rep    %2\;ror    %0\\n%l3\";
  1860.     }
  1861.     else
  1862.     {
  1863.     return \"tst    %2\;jeq    %l3\;do    %2,%l3\;ror    %0\\n%l3\";
  1864.     }
  1865. }")
  1866.  
  1867. ;;
  1868. ;;  ...........................................................................
  1869. ;;
  1870. ;;          COMPARISONS
  1871. ;;
  1872. ;;  ...........................................................................
  1873. ;;
  1874.  
  1875. ;; We provide quick software emulation via a subroutine that emulates
  1876. ;; a floating point instruction.
  1877.  
  1878. ( define_insn "cmpdf"
  1879.   [ ( set ( cc0 )
  1880.           ( compare ( match_operand:DF 0 "register_operand" "D" )
  1881.                     ( match_operand:DF 1 "register_operand" "D" )))
  1882.   ]
  1883.   ""
  1884.   "*
  1885. {
  1886.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  1887.     int op1_is_a = ( DSP16_A_REGNUM == REGNO ( operands[1] ));
  1888.     
  1889.     if ( op0_is_a )
  1890.     {
  1891.     if ( op1_is_a )
  1892.     {
  1893.         return \"jsr    fcmp_aa\";
  1894.     }
  1895.     else
  1896.     {
  1897.         return \"jsr    fcmp_ba\";
  1898.     }
  1899.     }
  1900.     else
  1901.     {
  1902.     if ( op1_is_a )
  1903.     {
  1904.         return \"jsr    fcmp_ab\";
  1905.     }
  1906.     else
  1907.     {
  1908.         return \"jsr    fcmp_bb\";
  1909.     }
  1910.     }
  1911. }" )    
  1912.  
  1913. ( define_insn "cmpsf"
  1914.   [ ( set ( cc0 )
  1915.           ( compare ( match_operand:SF 0 "register_operand" "D" )
  1916.                     ( match_operand:SF 1 "register_operand" "D" )))
  1917.   ]
  1918.   ""
  1919.   "*
  1920. {
  1921.     int op0_is_a = ( DSP16_A_REGNUM == REGNO ( operands[0] ));
  1922.     int op1_is_a = ( DSP16_A_REGNUM == REGNO ( operands[1] ));
  1923.     
  1924.     if ( op0_is_a )
  1925.     {
  1926.     if ( op1_is_a )
  1927.     {
  1928.         return \"jsr    fcmp_aa\";
  1929.     }
  1930.     else
  1931.     {
  1932.         return \"jsr    fcmp_ba\";
  1933.     }
  1934.     }
  1935.     else
  1936.     {
  1937.     if ( op1_is_a )
  1938.     {
  1939.         return \"jsr    fcmp_ab\";
  1940.     }
  1941.     else
  1942.     {
  1943.         return \"jsr    fcmp_bb\";
  1944.     }
  1945.     }
  1946. }" )    
  1947.  
  1948. ( define_insn "cmppsi"
  1949.   [ ( set ( cc0 )
  1950.           ( compare ( match_operand:PSI 0 "register_operand" "D" )
  1951.                     ( match_operand:PSI 1 "register_operand" "D" )))
  1952.   ]
  1953.   ""
  1954.   "*
  1955. {
  1956.     extern enum mdep_cc_info next_cc_use ( );
  1957.     extern rtx next_cc_relevancy ( );
  1958.     rtx relevant_insn, relevant_body;
  1959.     
  1960.     /* sometimes this compiler manages attempt ( compare ( reg x ) ( reg x )).
  1961.        the condition codes implied by this are obvious. we peek down the insn
  1962.        chain and discover the next_cc0_relevancy ( ). if we discover
  1963.        that the ccs are being set gratuitiously, we ignore this compare, 
  1964.        otherwise we change the cc0 consumer to be a constant load in the case
  1965.        of an Scond or a hard branch or nop in the case of a Bcond. */
  1966.  
  1967.     if ( REGNO ( operands[0] ) == REGNO ( operands[1] ))
  1968.     {
  1969.     relevant_insn = next_cc_relevancy ( insn );
  1970.     relevant_body = PATTERN ( relevant_insn );
  1971.     
  1972.     if ( JUMP_INSN == GET_CODE ( relevant_insn ))
  1973.     {
  1974.         if (( IF_THEN_ELSE == GET_CODE ( relevant_body =
  1975.                         XEXP ( relevant_body, 1 ))) &&
  1976.         ( CONST_INT != 
  1977.          GET_CODE ( XEXP ( relevant_body, 0 ))))
  1978.         {
  1979.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  1980.             ( GE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  1981.             ( LEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  1982.             ( LE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  1983.             ( EQU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  1984.             ( EQ == GET_CODE ( XEXP ( relevant_body, 0 ))))
  1985.         {
  1986.             /* change ineq into const1_rtx because x == x always. */
  1987.  
  1988.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  1989.                         1 ), 1 ))
  1990.             {
  1991.             delete_insn ( relevant_insn );
  1992.             }
  1993.             else
  1994.             {
  1995.             INSN_CODE ( relevant_insn ) = -1;
  1996.  
  1997.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  1998.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 1 );
  1999.             }
  2000.         }
  2001.         else
  2002.         {
  2003.             /* otherwise change ineq into const0_rtx. */
  2004.             
  2005.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2006.                         1 ), 1 ))
  2007.             {
  2008.             INSN_CODE ( relevant_insn ) = -1;
  2009.  
  2010.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2011.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 2 );
  2012.             }
  2013.             else
  2014.             {
  2015.             delete_insn ( relevant_insn );
  2016.             }
  2017.         }
  2018.         }
  2019.     }
  2020.     else if (( INSN == GET_CODE ( relevant_insn )) &&
  2021.          ( PARALLEL == GET_CODE ( relevant_body )) &&
  2022.          ( SET == GET_CODE ( relevant_body = 
  2023.                     XVECEXP ( relevant_body, 0, 0 ))) &&
  2024.          ( 0 == strcmp ( \"ee\",
  2025.                 GET_RTX_FORMAT ( GET_CODE ( XEXP ( relevant_body, 1 ))))) &&
  2026.          ( cc0_rtx == XEXP ( XEXP ( relevant_body, 1 ), 0 )))
  2027.     {
  2028.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2029.         ( GE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2030.         ( LEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2031.         ( LE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2032.         ( EQU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2033.         ( EQ == GET_CODE ( XEXP ( relevant_body, 1 ))))
  2034.         {
  2035.         /* change ineq into const1_rtx because x == x always. */
  2036.  
  2037.         XEXP ( relevant_body, 1 ) = const1_rtx;
  2038.         }
  2039.         else 
  2040.         {
  2041.         /* otherwise change ineq into const0_rtx. */
  2042.  
  2043.         XEXP ( relevant_body, 1 ) = const0_rtx;
  2044.         }
  2045.         INSN_CODE ( relevant_insn ) = -1;
  2046.     }
  2047.     return \"\";
  2048.     }
  2049.     
  2050.     if ( CC_UNSIGNED == next_cc_use ( insn ))
  2051.     {
  2052.     cc_status.mdep = CC_UNSIGNED;
  2053.     return \"move    #0,%k0\;move    #0,%k1\;cmp    %1,%0\";
  2054.     }
  2055.     else
  2056.     {
  2057.     cc_status.mdep = CC_SIGNED;
  2058.     return \"cmp    %1,%0\";
  2059.     }
  2060. }" )
  2061.  
  2062. ( define_insn ""
  2063.   [ ( set ( cc0 )
  2064.           ( compare ( match_operand:SI 0 "register_operand" "D" )
  2065.                     ( match_operand:SI 1 "register_operand" "D" )))
  2066.   ]
  2067.   "UNSIGNED_COMPARE_P ( insn )"
  2068.   "*
  2069. {
  2070.     extern enum mdep_cc_info next_cc_use ( );
  2071.     extern rtx next_cc_relevancy ( );
  2072.     rtx relevant_insn, relevant_body;
  2073.     
  2074.     /* sometimes this compiler manages attempt ( compare ( reg x ) ( reg x )).
  2075.        the condition codes implied by this are obvious. we peek down the insn
  2076.        chain and discover the next_cc0_relevancy ( ). if we discover
  2077.        that the ccs are being set gratuitiously, we ignore this compare, 
  2078.        otherwise we change the cc0 consumer to be a constant load in the case
  2079.        of an Scond or a hard branch or nop in the case of a Bcond. */
  2080.  
  2081.     if ( REGNO ( operands[0] ) == REGNO ( operands[1] ))
  2082.     {
  2083.     relevant_insn = next_cc_relevancy ( insn );
  2084.     relevant_body = PATTERN ( relevant_insn );
  2085.     
  2086.     if ( JUMP_INSN == GET_CODE ( relevant_insn ))
  2087.     {
  2088.         if (( IF_THEN_ELSE == GET_CODE ( relevant_body =
  2089.                         XEXP ( relevant_body, 1 ))) &&
  2090.         ( CONST_INT != 
  2091.          GET_CODE ( XEXP ( relevant_body, 0 ))))
  2092.         {
  2093.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2094.             ( GE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2095.             ( LEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2096.             ( LE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2097.             ( EQU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2098.             ( EQ == GET_CODE ( XEXP ( relevant_body, 0 ))))
  2099.         {
  2100.             /* change ineq into const1_rtx because x == x always. */
  2101.  
  2102.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2103.                         1 ), 1 ))
  2104.             {
  2105.             delete_insn ( relevant_insn );
  2106.             }
  2107.             else
  2108.             {
  2109.             INSN_CODE ( relevant_insn ) = -1;
  2110.  
  2111.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2112.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 1 );
  2113.             }
  2114.         }
  2115.         else
  2116.         {
  2117.             /* otherwise change ineq into const0_rtx. */
  2118.             
  2119.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2120.                         1 ), 1 ))
  2121.             {
  2122.             INSN_CODE ( relevant_insn ) = -1;
  2123.  
  2124.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2125.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 2 );
  2126.             }
  2127.             else
  2128.             {
  2129.             delete_insn ( relevant_insn );
  2130.             }
  2131.         }
  2132.         }
  2133.     }
  2134.     else if (( INSN == GET_CODE ( relevant_insn )) &&
  2135.          ( PARALLEL == GET_CODE ( relevant_body )) &&
  2136.          ( SET == GET_CODE ( relevant_body = 
  2137.                     XVECEXP ( relevant_body, 0, 0 ))) &&
  2138.          ( 0 == strcmp ( \"ee\",
  2139.                 GET_RTX_FORMAT ( GET_CODE ( XEXP ( relevant_body, 1 ))))) &&
  2140.          ( cc0_rtx == XEXP ( XEXP ( relevant_body, 1 ), 0 )))
  2141.     {
  2142.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2143.         ( GE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2144.         ( LEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2145.         ( LE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2146.         ( EQU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2147.         ( EQ == GET_CODE ( XEXP ( relevant_body, 1 ))))
  2148.         {
  2149.         /* change ineq into const1_rtx because x == x always. */
  2150.  
  2151.         XEXP ( relevant_body, 1 ) = const1_rtx;
  2152.         }
  2153.         else 
  2154.         {
  2155.         /* otherwise change ineq into const0_rtx. */
  2156.  
  2157.         XEXP ( relevant_body, 1 ) = const0_rtx;
  2158.         }
  2159.         INSN_CODE ( relevant_insn ) = -1;
  2160.     }
  2161.     return \"\";
  2162.     }
  2163.     
  2164.     cc_status.mdep = CC_UNSIGNED;
  2165.  
  2166.     return \"move    #0,%k0\;move    #0,%k1\;cmp    %1,%0\";
  2167. }" )
  2168.  
  2169. ( define_insn "cmpsi"
  2170.   [ ( set ( cc0 )
  2171.           ( compare ( match_operand:SI 0 "register_operand" "D" )
  2172.                     ( match_operand:SI 1 "register_operand" "*S*D" )))
  2173.   ]
  2174.   ""
  2175.   "*
  2176. {
  2177.     extern enum mdep_cc_info next_cc_use ( );
  2178.     extern rtx next_cc_relevancy ( );
  2179.     rtx relevant_insn, relevant_body;
  2180.     
  2181.     /* sometimes this compiler manages attempt ( compare ( reg x ) ( reg x )).
  2182.        the condition codes implied by this are obvious. we peek down the insn
  2183.        chain and discover the next_cc0_relevancy ( ). if we discover
  2184.        that the ccs are being set gratuitiously, we ignore this compare, 
  2185.        otherwise we change the cc0 consumer to be a constant load in the case
  2186.        of an Scond or a hard branch or nop in the case of a Bcond. */
  2187.  
  2188.     if ( REGNO ( operands[0] ) == REGNO ( operands[1] ))
  2189.     {
  2190.     relevant_insn = next_cc_relevancy ( insn );
  2191.     relevant_body = PATTERN ( relevant_insn );
  2192.     
  2193.     if ( JUMP_INSN == GET_CODE ( relevant_insn ))
  2194.     {
  2195.         if (( IF_THEN_ELSE == GET_CODE ( relevant_body =
  2196.                         XEXP ( relevant_body, 1 ))) &&
  2197.         ( CONST_INT != 
  2198.          GET_CODE ( XEXP ( relevant_body, 0 ))))
  2199.         {
  2200.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2201.             ( GE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2202.             ( LEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2203.             ( LE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2204.             ( EQU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2205.             ( EQ == GET_CODE ( XEXP ( relevant_body, 0 ))))
  2206.         {
  2207.             /* change ineq into const1_rtx because x == x always. */
  2208.  
  2209.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2210.                         1 ), 1 ))
  2211.             {
  2212.             delete_insn ( relevant_insn );
  2213.             }
  2214.             else
  2215.             {
  2216.             INSN_CODE ( relevant_insn ) = -1;
  2217.  
  2218.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2219.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 1 );
  2220.             }
  2221.         }
  2222.         else
  2223.         {
  2224.             /* otherwise change ineq into const0_rtx. */
  2225.             
  2226.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2227.                         1 ), 1 ))
  2228.             {
  2229.             INSN_CODE ( relevant_insn ) = -1;
  2230.  
  2231.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2232.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 2 );
  2233.             }
  2234.             else
  2235.             {
  2236.             delete_insn ( relevant_insn );
  2237.             }
  2238.         }
  2239.         }
  2240.     }
  2241.     else if (( INSN == GET_CODE ( relevant_insn )) &&
  2242.          ( PARALLEL == GET_CODE ( relevant_body )) &&
  2243.          ( SET == GET_CODE ( relevant_body = 
  2244.                     XVECEXP ( relevant_body, 0, 0 ))) &&
  2245.          ( 0 == strcmp ( \"ee\",
  2246.                 GET_RTX_FORMAT ( GET_CODE ( XEXP ( relevant_body, 1 ))))) &&
  2247.          ( cc0_rtx == XEXP ( XEXP ( relevant_body, 1 ), 0 )))
  2248.     {
  2249.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2250.         ( GE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2251.         ( LEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2252.         ( LE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2253.         ( EQU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2254.         ( EQ == GET_CODE ( XEXP ( relevant_body, 1 ))))
  2255.         {
  2256.         /* change ineq into const1_rtx because x == x always. */
  2257.  
  2258.         XEXP ( relevant_body, 1 ) = const1_rtx;
  2259.         }
  2260.         else 
  2261.         {
  2262.         /* otherwise change ineq into const0_rtx. */
  2263.  
  2264.         XEXP ( relevant_body, 1 ) = const0_rtx;
  2265.         }
  2266.         INSN_CODE ( relevant_insn ) = -1;
  2267.     }
  2268.     return \"\";
  2269.     }    
  2270.  
  2271.     cc_status.mdep = CC_SIGNED;
  2272.  
  2273.     return \"cmp    %1,%0\";
  2274. }" )
  2275.  
  2276. ( define_insn ""
  2277.   [ ( set ( cc0 )
  2278.           ( compare ( match_operand:DI 0 "register_operand" "D" )
  2279.                     ( match_operand:DI 1 "register_operand" "D" )))
  2280.   ]
  2281.   "UNSIGNED_COMPARE_P( insn )"
  2282.   "*
  2283. {
  2284.     extern enum mdep_cc_info next_cc_use ( );
  2285.     extern rtx next_cc_relevancy ( );
  2286.     rtx relevant_insn, relevant_body;
  2287.     
  2288.     /* sometimes this compiler manages attempt ( compare ( reg x ) ( reg x )).
  2289.        the condition codes implied by this are obvious. we peek down the insn
  2290.        chain and discover the next_cc0_relevancy ( ). if we discover
  2291.        that the ccs are being set gratuitiously, we ignore this compare, 
  2292.        otherwise we change the cc0 consumer to be a constant load in the case
  2293.        of an Scond or a hard branch or nop in the case of a Bcond. */
  2294.  
  2295.     if ( REGNO ( operands[0] ) == REGNO ( operands[1] ))
  2296.     {
  2297.     relevant_insn = next_cc_relevancy ( insn );
  2298.     relevant_body = PATTERN ( relevant_insn );
  2299.     
  2300.     if ( JUMP_INSN == GET_CODE ( relevant_insn ))
  2301.     {
  2302.         if (( IF_THEN_ELSE == GET_CODE ( relevant_body =
  2303.                         XEXP ( relevant_body, 1 ))) &&
  2304.         ( CONST_INT != 
  2305.          GET_CODE ( XEXP ( relevant_body, 0 ))))
  2306.         {
  2307.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2308.             ( GE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2309.             ( LEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2310.             ( LE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2311.             ( EQU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2312.             ( EQ == GET_CODE ( XEXP ( relevant_body, 0 ))))
  2313.         {
  2314.             /* change ineq into const1_rtx because x == x always. */
  2315.  
  2316.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2317.                         1 ), 1 ))
  2318.             {
  2319.             delete_insn ( relevant_insn );
  2320.             }
  2321.             else
  2322.             {
  2323.             INSN_CODE ( relevant_insn ) = -1;
  2324.  
  2325.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2326.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 1 );
  2327.             }
  2328.         }
  2329.         else
  2330.         {
  2331.             /* otherwise change ineq into const0_rtx. */
  2332.             
  2333.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2334.                         1 ), 1 ))
  2335.             {
  2336.             INSN_CODE ( relevant_insn ) = -1;
  2337.  
  2338.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2339.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 2 );
  2340.             }
  2341.             else
  2342.             {
  2343.             delete_insn ( relevant_insn );
  2344.             }
  2345.         }
  2346.         }
  2347.     }
  2348.     else if (( INSN == GET_CODE ( relevant_insn )) &&
  2349.          ( PARALLEL == GET_CODE ( relevant_body )) &&
  2350.          ( SET == GET_CODE ( relevant_body = 
  2351.                     XVECEXP ( relevant_body, 0, 0 ))) &&
  2352.          ( 0 == strcmp ( \"ee\",
  2353.                 GET_RTX_FORMAT ( GET_CODE ( XEXP ( relevant_body, 1 ))))) &&
  2354.          ( cc0_rtx == XEXP ( XEXP ( relevant_body, 1 ), 0 )))
  2355.     {
  2356.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2357.         ( GE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2358.         ( LEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2359.         ( LE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2360.         ( EQU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2361.         ( EQ == GET_CODE ( XEXP ( relevant_body, 1 ))))
  2362.         {
  2363.         /* change ineq into const1_rtx because x == x always. */
  2364.  
  2365.         XEXP ( relevant_body, 1 ) = const1_rtx;
  2366.         }
  2367.         else 
  2368.         {
  2369.         /* otherwise change ineq into const0_rtx. */
  2370.  
  2371.         XEXP ( relevant_body, 1 ) = const0_rtx;
  2372.         }
  2373.         INSN_CODE ( relevant_insn ) = -1;
  2374.     }
  2375.     return \"\";
  2376.     }
  2377.     
  2378.     cc_status.mdep = CC_UNSIGNED;
  2379.  
  2380.     return \"move    #0,%k0\;move    #0,%k1\;cmp    %1,%0\";
  2381. }" )
  2382.  
  2383. ( define_insn "cmpdi"
  2384.   [ ( set ( cc0 )
  2385.           ( compare ( match_operand:DI 0 "register_operand" "D" )
  2386.                     ( match_operand:DI 1 "register_operand" "D" )))
  2387.   ]
  2388.   ""
  2389.   "*
  2390. {
  2391.     extern enum mdep_cc_info next_cc_use ( );
  2392.     extern rtx next_cc_relevancy ( );
  2393.     rtx relevant_insn, relevant_body;
  2394.     
  2395.     /* sometimes this compiler manages attempt ( compare ( reg x ) ( reg x )).
  2396.        the condition codes implied by this are obvious. we peek down the insn
  2397.        chain and discover the next_cc0_relevancy ( ). if we discover
  2398.        that the ccs are being set gratuitiously, we ignore this compare, 
  2399.        otherwise we change the cc0 consumer to be a constant load in the case
  2400.        of an Scond or a hard branch or nop in the case of a Bcond. */
  2401.  
  2402.     if ( REGNO ( operands[0] ) == REGNO ( operands[1] ))
  2403.     {
  2404.     relevant_insn = next_cc_relevancy ( insn );
  2405.     relevant_body = PATTERN ( relevant_insn );
  2406.     
  2407.     if ( JUMP_INSN == GET_CODE ( relevant_insn ))
  2408.     {
  2409.         if (( IF_THEN_ELSE == GET_CODE ( relevant_body =
  2410.                         XEXP ( relevant_body, 1 ))) &&
  2411.         ( CONST_INT != 
  2412.          GET_CODE ( XEXP ( relevant_body, 0 ))))
  2413.         {
  2414.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2415.             ( GE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2416.             ( LEU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2417.             ( LE == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2418.             ( EQU == GET_CODE ( XEXP ( relevant_body, 0 ))) ||
  2419.             ( EQ == GET_CODE ( XEXP ( relevant_body, 0 ))))
  2420.         {
  2421.             /* change ineq into const1_rtx because x == x always. */
  2422.  
  2423.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2424.                         1 ), 1 ))
  2425.             {
  2426.             delete_insn ( relevant_insn );
  2427.             }
  2428.             else
  2429.             {
  2430.             INSN_CODE ( relevant_insn ) = -1;
  2431.  
  2432.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2433.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 1 );
  2434.             }
  2435.         }
  2436.         else
  2437.         {
  2438.             /* otherwise change ineq into const0_rtx. */
  2439.             
  2440.             if ( pc_rtx == XEXP ( XEXP ( PATTERN ( relevant_insn ),
  2441.                         1 ), 1 ))
  2442.             {
  2443.             INSN_CODE ( relevant_insn ) = -1;
  2444.  
  2445.             XEXP ( PATTERN ( relevant_insn ), 1 ) =
  2446.                 XEXP ( XEXP ( PATTERN ( relevant_insn ), 1 ), 2 );
  2447.             }
  2448.             else
  2449.             {
  2450.             delete_insn ( relevant_insn );
  2451.             }
  2452.         }
  2453.         }
  2454.     }
  2455.     else if (( INSN == GET_CODE ( relevant_insn )) &&
  2456.          ( PARALLEL == GET_CODE ( relevant_body )) &&
  2457.          ( SET == GET_CODE ( relevant_body = 
  2458.                     XVECEXP ( relevant_body, 0, 0 ))) &&
  2459.          ( 0 == strcmp ( \"ee\",
  2460.                 GET_RTX_FORMAT ( GET_CODE ( XEXP ( relevant_body, 1 ))))) &&
  2461.          ( cc0_rtx == XEXP ( XEXP ( relevant_body, 1 ), 0 )))
  2462.     {
  2463.         if (( GEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2464.         ( GE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2465.         ( LEU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2466.         ( LE == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2467.         ( EQU == GET_CODE ( XEXP ( relevant_body, 1 ))) ||
  2468.         ( EQ == GET_CODE ( XEXP ( relevant_body, 1 ))))
  2469.         {
  2470.         /* change ineq into const1_rtx because x == x always. */
  2471.  
  2472.         XEXP ( relevant_body, 1 ) = const1_rtx;
  2473.         }
  2474.         else 
  2475.         {
  2476.         /* otherwise change ineq into const0_rtx. */
  2477.  
  2478.         XEXP ( relevant_body, 1 ) = const0_rtx;
  2479.         }
  2480.         INSN_CODE ( relevant_insn ) = -1;
  2481.     }
  2482.     return \"\";
  2483.     }
  2484.     
  2485.     cc_status.mdep = CC_SIGNED;
  2486.  
  2487.     return \"cmp    %1,%0\";
  2488. }" )
  2489.  
  2490. ;;
  2491. ;;  ...........................................................................
  2492. ;;
  2493. ;;          TESTS
  2494. ;;
  2495. ;;  ...........................................................................
  2496. ;;
  2497.  
  2498. ( define_insn "tstpsi"
  2499.   [ ( set ( cc0 )
  2500.       ( match_operand:PSI 0 "register_operand" "D" )) ]
  2501.   ""
  2502.   "*
  2503. {
  2504.     if ( CC_UNSIGNED == ( cc_status.mdep = next_cc_use ( insn )))
  2505.     {
  2506.     return \"move    #0,%k0\;tst    %0\";
  2507.     }
  2508.     else
  2509.     {
  2510.     return \"tst    %0\";
  2511.     }
  2512. }" )
  2513.  
  2514. ( define_insn "tstsi"
  2515.   [ ( set ( cc0 )
  2516.       ( match_operand:SI 0 "register_operand" "D" )) ]
  2517.   ""
  2518.   "*
  2519. {
  2520.     if ( CC_UNSIGNED == ( cc_status.mdep = next_cc_use ( insn )))
  2521.     {
  2522.     return \"move    #0,%k0\;tst    %0\";
  2523.     }
  2524.     else
  2525.     {
  2526.     return \"tst    %0\";
  2527.     }
  2528. }" )
  2529.  
  2530. ( define_insn "tstdi"
  2531.   [ ( set ( cc0 )
  2532.       ( match_operand:DI 0 "general_operand" "D" )) ]
  2533.   ""
  2534.   "*
  2535. {
  2536.     if ( CC_UNSIGNED == ( cc_status.mdep = next_cc_use ( insn )))
  2537.     {
  2538.     return \"move    #0,%k0\;tst    %0\";
  2539.     }
  2540.     else
  2541.     {
  2542.     return \"tst    %0\";
  2543.     }
  2544. }" )
  2545.  
  2546. ;;
  2547. ;;  ...........................................................................
  2548. ;;
  2549. ;;          SCALAR CONVERSIONS USING TRUNCATION
  2550. ;;
  2551. ;;  ...........................................................................
  2552. ;;
  2553.  
  2554. ( define_insn "truncsipsi2"
  2555.   [ ( set ( match_operand:PSI 0 "register_operand" "=A" )
  2556.       ( truncate:PSI
  2557.         ( match_operand:SI 1 "register_operand" "=*S*D" )))
  2558.   ]
  2559.   ""
  2560.   "move    %e1,%0" )
  2561.  
  2562. ( define_insn "truncdisi2"
  2563.   [ ( set ( match_operand:SI 0 "general_operand" "=*S*D" )
  2564.       ( truncate:SI
  2565.         ( match_operand:DI 1 "general_operand" "*S*D" )))
  2566.   ]
  2567.   ""
  2568.   "*
  2569. {
  2570.     switch ( which_alternative )
  2571.     {
  2572.     case 0:
  2573.     if ( IS_SRC_OR_MPY_P ( REGNO ( operands[1] )))
  2574.     {
  2575.         return \"move    %g1,%0\";
  2576.     }
  2577.     else
  2578.     {
  2579.         return \"move    %h1,%0\";
  2580.     }
  2581.     }
  2582. }")
  2583.     
  2584. ;;
  2585. ;;  ...........................................................................
  2586. ;;
  2587. ;;          SCALAR CONVERSIONS USING ZERO EXTENSION
  2588. ;;
  2589. ;;  ...........................................................................
  2590. ;;
  2591.  
  2592. ( define_expand "zero_extendqisi2"
  2593.   [ ( set ( match_operand:SI 0 "register_operand" "" )
  2594.       ( zero_extend:SI
  2595.         ( match_operand:QI 1 "register_operand" "" )))
  2596.   ]
  2597.   ""
  2598.   "
  2599. {
  2600.     if ( SUBREG == GET_CODE ( operands[1] ))
  2601.     {
  2602.     operands[1] = copy_rtx ( SUBREG_REG ( operands[1] ));
  2603.     }
  2604.     else
  2605.     {
  2606.     operands[1] = copy_rtx ( operands[1] );
  2607.     }    
  2608.     operands[1] = gen_rtx ( SUBREG, SImode, operands[1], 0 );
  2609.     
  2610.     emit_insn ( gen_rtx ( SET, VOIDmode, operands[0], operands[1] ));
  2611.  
  2612.     DONE;
  2613. }" )
  2614.  
  2615. ( define_insn "zero_extendpsisi2"
  2616.   [ ( set ( match_operand:SI 0 "general_operand" "=*D*S" )
  2617.       ( zero_extend:SI 
  2618.         ( match_operand:PSI 1 "general_operand" "*A*D*S" )))
  2619.   ]
  2620.   ""
  2621.   "*
  2622. {
  2623.     /* we may want to add mem-ref as an opt. later. */
  2624.  
  2625.     if ( REGNO ( operands[0] ) == REGNO ( operands[1] ))
  2626.     {
  2627.     return \"\";
  2628.     }
  2629.     
  2630.     return \"move    %1,%0\";
  2631. }")
  2632.  
  2633. ( define_insn "zero_extendsidi2"
  2634.   [ ( set ( match_operand:DI 0 "general_operand" "=&*S*D" )
  2635.       ( zero_extend:DI 
  2636.         ( match_operand:SI 1 "general_operand" "*S*D" )))
  2637.   ]
  2638.   ""
  2639.   "*
  2640. {
  2641.     if ( DST_REGS == REGNO_REG_CLASS ( REGNO ( operands[0] )))
  2642.     {
  2643.     return \"clr    %0\;move    %1,%h0\";
  2644.     }
  2645.     else
  2646.     {
  2647.     return \"move    %1,%0\;move    #0,%g0\";
  2648.     }
  2649. }")
  2650.  
  2651. ;;
  2652. ;;  ...........................................................................
  2653. ;;
  2654. ;;          SCALAR CONVERSIONS USING SIGN EXTENSION
  2655. ;;
  2656. ;;  ...........................................................................
  2657. ;;
  2658.  
  2659. ( define_expand "extendqisi2"
  2660.   [ ( set ( match_operand:SI 0 "register_operand" "" )
  2661.       ( sign_extend:SI
  2662.         ( match_operand:QI 1 "register_operand" "" )))
  2663.   ]
  2664.   ""
  2665.   "
  2666. {
  2667.     if ( SUBREG == GET_CODE ( operands[1] ))
  2668.     {
  2669.     operands[1] = copy_rtx ( SUBREG_REG ( operands[1] ));
  2670.     }
  2671.     else
  2672.     {
  2673.     operands[1] = copy_rtx ( operands[1] );
  2674.     }
  2675.     operands[1] = gen_rtx ( SUBREG, SImode, operands[1], 0 );
  2676.     
  2677.     emit_insn ( gen_rtx ( SET, VOIDmode, operands[0], operands[1] ));
  2678.  
  2679.     DONE;
  2680. }" )
  2681.  
  2682. ( define_insn "extendsidi2"
  2683.   [ ( set ( match_operand:DI 0 "general_operand" "=S" )
  2684.       ( sign_extend:DI 
  2685.         ( match_operand:SI 1 "general_operand" "D" )))
  2686.   ]
  2687.   ""
  2688.   "move    %1,%0\;move    %k1,%g0" )
  2689.  
  2690. ( define_insn "extendpsisi2"
  2691.   [ ( set ( match_operand:SI 0 "general_operand" "=D" )
  2692.       ( sign_extend:SI 
  2693.         ( match_operand:PSI 1 "general_operand" "*A*S" )))
  2694.   ]
  2695.   ""
  2696.   "*
  2697. {
  2698.     /* we may want to add mem-ref as an opt. later. */
  2699.  
  2700.     if ( DST_REGS == REGNO_REG_CLASS ( REGNO ( operands[0] )) &&
  2701.     ADDR_REGS != REGNO_REG_CLASS ( REGNO ( operands[1] )) &&
  2702.     ! MEM_IN_STRUCT_P ( operands[0] ) &&
  2703.     ! MEM_IN_STRUCT_P ( operands[1] ))
  2704.     {
  2705.     return \"tfr    %1,%0\";
  2706.     }
  2707.     else
  2708.     {
  2709.     return \"move    %1,%0\";
  2710.     }
  2711. }")
  2712.  
  2713. ;;
  2714. ;;  ...........................................................................
  2715. ;;
  2716. ;;          CONVERSIONS BETWEEN FLOAT AND DOUBLE
  2717. ;;
  2718. ;;  ...........................................................................
  2719. ;;
  2720.  
  2721. ;;
  2722. ;;  ...........................................................................
  2723. ;;
  2724. ;;          CONVERSIONS BETWEEN FLOATING POINT AND INTEGER
  2725. ;;
  2726. ;;  ...........................................................................
  2727. ;;
  2728.  
  2729.  ;; Using the signed routine at this point - this is a bug.
  2730.  
  2731. ( define_insn "floatunssidf2"
  2732.   [ ( set ( match_operand:DF 0 "register_operand" "=D" )
  2733.       ( unsigned_float:DF 
  2734.         ( match_operand:SI 1 "register_operand" "0" )))
  2735.   ]
  2736.   ""
  2737.   "*
  2738. {
  2739.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2740.     {
  2741.     return \"jsr    floatsidf_a\";
  2742.     }
  2743.     else
  2744.     {
  2745.     return \"jsr    floatsidf_b\";
  2746.     }
  2747. }" )
  2748.  
  2749.  ;; Using the signed routine at this point - this is a bug.
  2750.  
  2751. ( define_insn "floatunssisf2"
  2752.   [ ( set ( match_operand:SF 0 "register_operand" "=D" )
  2753.       ( unsigned_float:SF 
  2754.         ( match_operand:SI 1 "register_operand" "0" )))
  2755.   ]
  2756.   ""
  2757.   "*
  2758. {
  2759.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2760.     {
  2761.     return \"jsr    floatsidf_a\";
  2762.     }
  2763.     else
  2764.     {
  2765.     return \"jsr    floatsidf_b\";
  2766.     }
  2767. }" )
  2768.  
  2769. ( define_insn "floatsidf2"
  2770.   [ ( set ( match_operand:DF 0 "register_operand" "=D" )
  2771.       ( float:DF 
  2772.         ( match_operand:SI 1 "register_operand" "0" )))
  2773.   ]
  2774.   ""
  2775.   "*
  2776. {
  2777.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2778.     {
  2779.     return \"jsr    floatsidf_a\";
  2780.     }
  2781.     else
  2782.     {
  2783.     return \"jsr    floatsidf_b\";
  2784.     }
  2785. }" )
  2786.     
  2787. ( define_insn "floatsisf2"
  2788.   [ ( set ( match_operand:SF 0 "register_operand" "=D" )
  2789.       ( float:SF 
  2790.         ( match_operand:SI 1 "register_operand" "0" )))
  2791.   ]
  2792.   ""
  2793.   "*
  2794. {
  2795.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2796.     {
  2797.     return \"jsr    floatsidf_a\";
  2798.     }
  2799.     else
  2800.     {
  2801.     return \"jsr    floatsidf_b\";
  2802.     }
  2803. }" )
  2804.  
  2805. ( define_insn "fixdfsi2"
  2806.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  2807.       ( fix:SI 
  2808.         ( match_operand:DF 1 "register_operand" "0" )))
  2809.   ]
  2810.   ""
  2811.   "*
  2812. {
  2813.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2814.     {
  2815.     return \"jsr    fixdfsi_a\";
  2816.     }
  2817.     else
  2818.     {
  2819.     return \"jsr    fixdfsi_b\";
  2820.     }
  2821. }" )
  2822.  
  2823. ( define_insn "fixsfsi2"
  2824.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  2825.       ( fix:SI 
  2826.         ( match_operand:SF 1 "register_operand" "0" )))
  2827.   ]
  2828.   ""
  2829.   "*
  2830. {
  2831.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2832.     {
  2833.     return \"jsr    fixdfsi_a\";
  2834.     }
  2835.     else
  2836.     {
  2837.     return \"jsr    fixdfsi_b\";
  2838.     }
  2839. }" )
  2840.  
  2841. ( define_insn "fixunsdfsi2"
  2842.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  2843.       ( unsigned_fix:SI 
  2844.         ( match_operand:DF 1 "register_operand" "0" )))
  2845.   ]
  2846.   ""
  2847.   "*
  2848. {
  2849.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2850.     {
  2851.     return \"jsr    fixunsdfsi_a\";
  2852.     }
  2853.     else
  2854.     {
  2855.     return \"jsr    fixunsdfsi_b\";
  2856.     }
  2857. }" )
  2858.  
  2859. ( define_insn "fixunssfsi2"
  2860.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  2861.       ( unsigned_fix:SI 
  2862.         ( match_operand:SF 1 "register_operand" "0" )))
  2863.   ]
  2864.   ""
  2865.   "*
  2866. {
  2867.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2868.     {
  2869.     return \"jsr    fixunsdfsi_a\";
  2870.     }
  2871.     else
  2872.     {
  2873.     return \"jsr    fixunsdfsi_b\";
  2874.     }
  2875. }" )
  2876.  
  2877.  ;; Using the signed routine at this point - this is a bug.
  2878.  
  2879. ( define_insn "floatunsdidf2"
  2880.   [ ( set ( match_operand:DF 0 "register_operand" "=D" )
  2881.       ( unsigned_float:DF 
  2882.         ( match_operand:DI 1 "register_operand" "0" )))
  2883.   ]
  2884.   ""
  2885.   "*
  2886. {
  2887.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2888.     {
  2889.     return \"jsr    floatdidf_a\";
  2890.     }
  2891.     else
  2892.     {
  2893.     return \"jsr    floatdidf_b\";
  2894.     }
  2895. }" )
  2896.  
  2897.  ;; Using the signed routine at this point - this is a bug.
  2898.  
  2899. ( define_insn "floatunsdisf2"
  2900.   [ ( set ( match_operand:SF 0 "register_operand" "=D" )
  2901.       ( unsigned_float:SF 
  2902.         ( match_operand:DI 1 "register_operand" "0" )))
  2903.   ]
  2904.   ""
  2905.   "*
  2906. {
  2907.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2908.     {
  2909.     return \"jsr    floatdidf_a\";
  2910.     }
  2911.     else
  2912.     {
  2913.     return \"jsr    floatdidf_b\";
  2914.     }
  2915. }" )
  2916.  
  2917. ( define_insn "floatdidf2"
  2918.   [ ( set ( match_operand:DF 0 "register_operand" "=D" )
  2919.       ( float:DF 
  2920.         ( match_operand:DI 1 "register_operand" "0" )))
  2921.   ]
  2922.   ""
  2923.   "*
  2924. {
  2925.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2926.     {
  2927.     return \"jsr    floatdidf_a\";
  2928.     }
  2929.     else
  2930.     {
  2931.     return \"jsr    floatdidf_b\";
  2932.     }
  2933. }" )
  2934.     
  2935. ( define_insn "floatdisf2"
  2936.   [ ( set ( match_operand:SF 0 "register_operand" "=D" )
  2937.       ( float:SF 
  2938.         ( match_operand:DI 1 "register_operand" "0" )))
  2939.   ]
  2940.   ""
  2941.   "*
  2942. {
  2943.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2944.     {
  2945.     return \"jsr    floatdidf_a\";
  2946.     }
  2947.     else
  2948.     {
  2949.     return \"jsr    floatdidf_b\";
  2950.     }
  2951. }" )
  2952.  
  2953. ( define_insn "fixdfdi2"
  2954.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  2955.       ( fix:DI 
  2956.         ( match_operand:DF 1 "register_operand" "0" )))
  2957.   ]
  2958.   ""
  2959.   "*
  2960. {
  2961.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2962.     {
  2963.     return \"jsr    fixdfdi_a\";
  2964.     }
  2965.     else
  2966.     {
  2967.     return \"jsr    fixdfdi_b\";
  2968.     }
  2969. }" )
  2970.  
  2971. ( define_insn "fixsfdi2"
  2972.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  2973.       ( fix:DI 
  2974.         ( match_operand:SF 1 "register_operand" "0" )))
  2975.   ]
  2976.   ""
  2977.   "*
  2978. {
  2979.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2980.     {
  2981.     return \"jsr    fixdfdi_a\";
  2982.     }
  2983.     else
  2984.     {
  2985.     return \"jsr    fixdfdi_b\";
  2986.     }
  2987. }" )
  2988.  
  2989. ( define_insn "fixunsdfdi2"
  2990.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  2991.       ( unsigned_fix:DI 
  2992.         ( match_operand:DF 1 "register_operand" "0" )))
  2993.   ]
  2994.   ""
  2995.   "*
  2996. {
  2997.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  2998.     {
  2999.     return \"jsr    fixunsdfdi_a\";
  3000.     }
  3001.     else
  3002.     {
  3003.     return \"jsr    fixunsdfdi_b\";
  3004.     }
  3005. }" )
  3006.  
  3007. ( define_insn "fixunssfdi2"
  3008.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  3009.       ( unsigned_fix:DI 
  3010.         ( match_operand:SF 1 "register_operand" "0" )))
  3011.   ]
  3012.   ""
  3013.   "*
  3014. {
  3015.     if ( DSP16_A_REGNUM == REGNO ( operands[0] ))
  3016.     {
  3017.     return \"jsr    fixunsdfdi_a\";
  3018.     }
  3019.     else
  3020.     {
  3021.     return \"jsr    fixunsdfdi_b\";
  3022.     }
  3023. }" )
  3024.  
  3025. ( define_expand "fix_truncdfsi2"
  3026.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3027.       ( fix:SI 
  3028.         ( match_operand:DF 1 "register_operand" "0" )))
  3029.   ]
  3030.   ""
  3031.   "" )
  3032.  
  3033. ( define_expand "fix_truncsfsi2"
  3034.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3035.       ( fix:SI 
  3036.         ( match_operand:SF 1 "register_operand" "0" )))
  3037.   ]
  3038.   ""
  3039.   "" )
  3040.  
  3041. ( define_expand "fixuns_truncdfsi2"
  3042.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3043.       ( unsigned_fix:SI 
  3044.         ( match_operand:DF 1 "register_operand" "0" )))
  3045.   ]
  3046.   ""
  3047.   "" )
  3048.  
  3049. ( define_expand "fixuns_truncsfsi2"
  3050.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3051.       ( unsigned_fix:SI 
  3052.         ( match_operand:SF 1 "register_operand" "0" )))
  3053.   ]
  3054.   ""
  3055.   "" )
  3056.  
  3057. ( define_expand "fix_truncdfdi2"
  3058.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  3059.       ( fix:DI 
  3060.         ( match_operand:DF 1 "register_operand" "0" )))
  3061.   ]
  3062.   ""
  3063.   "" )
  3064.  
  3065. ( define_expand "fix_truncsfdi2"
  3066.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  3067.       ( fix:DI 
  3068.         ( match_operand:SF 1 "register_operand" "0" )))
  3069.   ]
  3070.   ""
  3071.   "" )
  3072.  
  3073. ( define_expand "fixuns_truncdfdi2"
  3074.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  3075.       ( unsigned_fix:DI 
  3076.         ( match_operand:DF 1 "register_operand" "0" )))
  3077.   ]
  3078.   ""
  3079.   "" )
  3080.  
  3081. ( define_expand "fixuns_truncsfdi2"
  3082.   [ ( set ( match_operand:DI 0 "register_operand" "=D" )
  3083.       ( unsigned_fix:DI 
  3084.         ( match_operand:SF 1 "register_operand" "0" )))
  3085.   ]
  3086.   ""
  3087.   "" )
  3088.  
  3089. ;;
  3090. ;;  ...........................................................................
  3091. ;;
  3092. ;;          CONDITIONAL JUMPS
  3093. ;;
  3094. ;;  ...........................................................................
  3095. ;;
  3096.  
  3097. ( define_insn "do"
  3098.   [ ( parallel
  3099.       [ ( clobber ( cc0 ))
  3100.     ( use ( match_operand:SI 0 "general_operand" "*D*S,J" ))
  3101.     ( set ( pc ) ( if_then_else ( eq ( cc0 ) ( const_int 0 ))
  3102.                     ( label_ref ( match_operand 1 "" "" ))
  3103.                     ( pc )))
  3104.       ] )
  3105.   ]
  3106.   ""
  3107.   "*
  3108. {
  3109.     extern void record_address_regs_used ( );
  3110.     
  3111.     /* we must scan forward and make sure that there is at least one non-do
  3112.      * insn between this insn and the target label. If not, 86 the loop. 
  3113.      * BTW, a nop instruction doesn't count.
  3114.      */
  3115.     rtx scan = insn;
  3116.     
  3117.     while ( scan && ( operands[1] != scan ))
  3118.     {
  3119.     if (( INSN == GET_CODE ( scan )) && 
  3120.         ( const0_rtx != PATTERN ( scan )))
  3121.     {
  3122.         break;
  3123.     }
  3124.         scan = NEXT_INSN ( scan );
  3125.     }
  3126.     
  3127.     if ( ! scan )
  3128.     {
  3129.     /* do without corresponding od ! */
  3130.     abort ( );
  3131.     }
  3132.     if (( scan == operands[1] ) ||
  3133.     ( which_alternative && ( 1 == INTVAL ( operands[0] ))))
  3134.     {
  3135.     /* we're not really doing a do; record that no conflicts are 
  3136.      * possible.
  3137.      */
  3138.     record_address_regs_used ( const0_rtx );
  3139.  
  3140.     /* decrement the number of uses at the target label. */
  3141.  
  3142.     -- LABEL_NUSES ( operands[1] );
  3143.  
  3144.     return \"\";
  3145.     }
  3146.  
  3147.     /* record potential r/n register conflicts. */
  3148.     record_address_regs_used ( PATTERN ( scan ));
  3149.  
  3150.     if ( which_alternative )
  3151.     {
  3152.     return \"do    #%c0,%l1\";
  3153.     }
  3154.     else
  3155.     {
  3156.     if ( IS_SRC_OR_MPY_P ( REGNO ( operands[0] )))
  3157.     {
  3158.         return \"do    %0,%l1\";
  3159.     }
  3160.     else
  3161.     {
  3162.         return \"do    %e0,%l1\";
  3163.     }
  3164.     }
  3165. }" )
  3166.  
  3167. ;; This shape should match the back-branch insn and produce no real code.
  3168. ;; It is a placeholder so that the compiler knows that the do loop target
  3169. ;; label is implicitly a branch.
  3170.  
  3171. ( define_insn "od"
  3172.   [ ( parallel 
  3173.       [ ( clobber ( cc0 ))
  3174.     ( set ( pc ) ( match_operand 0 "" "" ))
  3175.       ] )
  3176.   ]
  3177.   ""
  3178.   "*
  3179. {
  3180.     rtx scan = PREV_INSN ( insn );
  3181.     
  3182.     while ( scan && 
  3183.        (( INSN != GET_CODE ( scan )) || 
  3184.         /* ignore latent nop insns! */
  3185.         ( const0_rtx == PATTERN ( scan ))) &&
  3186.        ( JUMP_INSN != GET_CODE ( scan )))
  3187.     {
  3188.     scan = PREV_INSN ( scan );
  3189.     }
  3190.     if ( ! scan )
  3191.     {
  3192.     /* od without corresponding do ! */
  3193.     abort ( );
  3194.     }
  3195.     if ( JUMP_INSN == GET_CODE ( scan ))
  3196.     {
  3197.     /* pop the stack - no chance of conflict. */
  3198.     (void) conflicting_address_regs_set_p ( const0_rtx );
  3199.     
  3200.     /* but hey- auto bonejob! we can't have a jmp as the last insn
  3201.        within the DO! */
  3202.  
  3203.     return \"nop\";
  3204.     }
  3205.     if ( INSN == GET_CODE ( scan ))
  3206.     {
  3207.     /* if we have a conflict, emit a noop to sw interlock. */
  3208.     if ( conflicting_address_regs_set_p ( PATTERN ( scan )))
  3209.     {
  3210.         return \"nop\";
  3211.     }
  3212.     }
  3213.     return \"\";
  3214. }" )
  3215.  
  3216. ( define_insn ""
  3217.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=D,D" )
  3218.                ( match_operand:SI 1 "general_operand" "i,!*D*S*A" ))
  3219.          ( clobber 
  3220.            ( match_operand:SI 2 "register_operand" "=*D*S*A,*D*S*A" ))
  3221.          ])
  3222.   ]
  3223.   ""
  3224.   "*
  3225. {
  3226.     switch ( which_alternative )
  3227.     {
  3228.     case 0:
  3229.     if ( 0 == INTVAL ( operands[1] ))
  3230.     {
  3231.         return \"clr    %0\";
  3232.     }
  3233.     else
  3234.     {
  3235.         return \"move    #>1,%0\";
  3236.     }
  3237.  
  3238.     case 1:
  3239.     if ( DST_REGS == REGNO_REG_CLASS ( REGNO ( operands[1] )))
  3240.     {
  3241.         return \"move    %e1,%0\";
  3242.     }
  3243.     else
  3244.     {
  3245.         return \"move    %1,%0\";
  3246.     }
  3247.     }
  3248. }" )
  3249.  
  3250. ( define_expand "seq"
  3251.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3252.       ( eq ( cc0 ) ( const_int 0 ))) ]
  3253.   ""
  3254.   "
  3255. {
  3256.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3257.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3258.                gen_rtx ( EQ, VOIDmode, cc0_rtx, const0_rtx ));
  3259.         
  3260.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3261.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3262.     DONE;
  3263. }" )
  3264.     
  3265. ( define_insn ""
  3266.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3267.                ( eq ( cc0 ) ( const_int 0 )))
  3268.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3269.          ])
  3270.   ]
  3271.   ""
  3272.   "move    #>1,%1\;move    #0,%0\;teq    %1,%0" )
  3273.  
  3274. ( define_insn "beq"
  3275.   [ ( set ( pc )
  3276.       ( if_then_else ( eq ( cc0 )
  3277.                   ( const_int 0 ) )
  3278.              ( label_ref ( match_operand 0 "" "" ) )
  3279.              ( pc ) ) ) ]
  3280.   ""
  3281.   "jeq    %l0" )
  3282.  
  3283. ( define_expand "sequ"
  3284.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3285.       ( equ ( cc0 ) ( const_int 0 ))) ]
  3286.   ""
  3287.   "
  3288. {
  3289.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3290.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3291.                gen_rtx ( EQU, VOIDmode, cc0_rtx, const0_rtx ));
  3292.         
  3293.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3294.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3295.     DONE;
  3296. }" )
  3297.     
  3298. ( define_insn ""
  3299.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3300.                ( equ ( cc0 ) ( const_int 0 )))
  3301.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3302.          ])
  3303.   ]
  3304.   ""
  3305.   "move    #>1,%1\;move    #0,%0\;teq    %1,%0" )
  3306.  
  3307. ( define_insn "bequ"
  3308.   [ ( set ( pc )
  3309.       ( if_then_else ( equ ( cc0 )
  3310.                   ( const_int 0 ) )
  3311.              ( label_ref ( match_operand 0 "" "" ) )
  3312.              ( pc ) ) ) ]
  3313.   ""
  3314.   "jeq    %l0" )
  3315.  
  3316. ( define_expand "sne"
  3317.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3318.       ( ne ( cc0 ) ( const_int 0 ))) ]
  3319.   ""
  3320.   "
  3321. {
  3322.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3323.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3324.                gen_rtx ( NE, VOIDmode, cc0_rtx, const0_rtx ));
  3325.         
  3326.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3327.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3328.     DONE;
  3329. }" )
  3330.     
  3331. ( define_insn ""
  3332.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3333.                ( ne ( cc0 ) ( const_int 0 )))
  3334.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3335.          ])
  3336.   ]
  3337.   ""
  3338.   "move    #>1,%1\;move    #0,%0\;tne    %1,%0" )
  3339.  
  3340. ( define_insn "bne"
  3341.   [ ( set ( pc )
  3342.       ( if_then_else ( ne ( cc0 )
  3343.                   ( const_int 0 ) )
  3344.              ( label_ref ( match_operand 0 "" "" ) )
  3345.              ( pc ) ) ) ]
  3346.   ""
  3347.   "jne    %l0" )
  3348.  
  3349. ( define_expand "sneu"
  3350.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3351.       ( neu ( cc0 ) ( const_int 0 ))) ]
  3352.   ""
  3353.   "
  3354. {
  3355.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3356.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3357.                gen_rtx ( NEU, VOIDmode, cc0_rtx, const0_rtx ));
  3358.         
  3359.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3360.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3361.     DONE;
  3362. }" )
  3363.     
  3364. ( define_insn ""
  3365.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3366.                ( neu ( cc0 ) ( const_int 0 )))
  3367.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3368.          ])
  3369.   ]
  3370.   ""
  3371.   "move    #>1,%1\;move    #0,%0\;tne    %1,%0" )
  3372.  
  3373. ( define_insn "bneu"
  3374.   [ ( set ( pc )
  3375.       ( if_then_else ( neu ( cc0 )
  3376.                   ( const_int 0 ) )
  3377.              ( label_ref ( match_operand 0 "" "" ) )
  3378.              ( pc ) ) ) ]
  3379.   ""
  3380.   "jne    %l0" )
  3381.  
  3382. ( define_expand "sgt"
  3383.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3384.       ( gt ( cc0 ) ( const_int 0 ))) ]
  3385.   ""
  3386.   "
  3387. {
  3388.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3389.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3390.                gen_rtx ( GT, VOIDmode, cc0_rtx, const0_rtx ));
  3391.         
  3392.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3393.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3394.     DONE;
  3395. }" )
  3396.     
  3397. ( define_insn ""
  3398.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3399.                ( gt ( cc0 ) ( const_int 0 )))
  3400.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3401.          ])
  3402.   ]
  3403.   ""
  3404.   "move    #>1,%1\;move    #0,%0\;tgt    %1,%0" )
  3405.  
  3406. ( define_insn "bgt"
  3407.   [ ( set ( pc )
  3408.       ( if_then_else ( gt ( cc0 )
  3409.                   ( const_int 0 ) )
  3410.              ( label_ref ( match_operand 0 "" "" ) )
  3411.              ( pc ) ) ) ]
  3412.   ""
  3413.   "jgt    %l0" )
  3414.  
  3415. ( define_expand "sgtu"
  3416.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3417.       ( gtu ( cc0 ) ( const_int 0 ))) ]
  3418.   ""
  3419.   "
  3420. {
  3421.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3422.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3423.                gen_rtx ( GTU, VOIDmode, cc0_rtx, const0_rtx ));
  3424.         
  3425.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3426.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3427.     DONE;
  3428. }" )
  3429.     
  3430. ( define_insn ""
  3431.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3432.                ( gtu ( cc0 ) ( const_int 0 )))
  3433.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3434.          ])
  3435.   ]
  3436.   ""
  3437.   "move    #>1,%1\;move    #0,%0\;tgt    %1,%0" )
  3438.  
  3439. ( define_insn "bgtu"
  3440.   [ ( set ( pc )
  3441.       ( if_then_else ( gtu ( cc0 )
  3442.                    ( const_int 0 ) )
  3443.              ( label_ref ( match_operand 0 "" "" ) )
  3444.              ( pc ) ) ) ]
  3445.   ""
  3446.   "jgt    %l0" )
  3447.  
  3448. ( define_expand "slt"
  3449.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3450.       ( lt ( cc0 ) ( const_int 0 ))) ]
  3451.   ""
  3452.   "
  3453. {
  3454.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3455.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3456.                gen_rtx ( LT, VOIDmode, cc0_rtx, const0_rtx ));
  3457.         
  3458.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3459.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3460.     DONE;
  3461. }" )
  3462.     
  3463. ( define_insn ""
  3464.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3465.                ( lt ( cc0 ) ( const_int 0 )))
  3466.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3467.          ])
  3468.   ]
  3469.   ""
  3470.   "move    #>1,%1\;move    #0,%0\;tlt    %1,%0" )
  3471.  
  3472. ( define_insn "blt"
  3473.   [ ( set ( pc )
  3474.       ( if_then_else ( lt ( cc0 )
  3475.                   ( const_int 0 ) )
  3476.              ( label_ref ( match_operand 0 "" "" ) )
  3477.              ( pc ) ) ) ]
  3478.   ""
  3479.   "jlt    %l0" )
  3480.  
  3481. ( define_expand "sltu"
  3482.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3483.       ( ltu ( cc0 ) ( const_int 0 ))) ]
  3484.   ""
  3485.   "
  3486. {
  3487.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3488.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3489.                gen_rtx ( LTU, VOIDmode, cc0_rtx, const0_rtx ));
  3490.         
  3491.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3492.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3493.     DONE;
  3494. }" )
  3495.     
  3496. ( define_insn ""
  3497.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3498.                ( ltu ( cc0 ) ( const_int 0 )))
  3499.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3500.          ])
  3501.   ]
  3502.   ""
  3503.   "move    #>1,%1\;move    #0,%0\;tlt    %1,%0" )
  3504.  
  3505. ( define_insn "bltu"
  3506.   [ ( set ( pc )
  3507.       ( if_then_else ( ltu ( cc0 )
  3508.                    ( const_int 0 ) )
  3509.              ( label_ref ( match_operand 0 "" "" ) )
  3510.              ( pc ) ) ) ]
  3511.   ""
  3512.   "jlt    %l0" )
  3513.  
  3514. ( define_expand "sge"
  3515.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3516.       ( ge ( cc0 ) ( const_int 0 ))) ]
  3517.   ""
  3518.   "
  3519. {
  3520.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3521.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3522.                gen_rtx ( GE, VOIDmode, cc0_rtx, const0_rtx ));
  3523.         
  3524.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3525.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3526.     DONE;
  3527. }" )
  3528.     
  3529. ( define_insn ""
  3530.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3531.                ( ge ( cc0 ) ( const_int 0 )))
  3532.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3533.          ])
  3534.   ]
  3535.   ""
  3536.   "move    #>1,%1\;move    #0,%0\;tge    %1,%0" )
  3537.  
  3538. ( define_insn "bge"
  3539.   [ ( set ( pc )
  3540.       ( if_then_else ( ge ( cc0 )
  3541.                   ( const_int 0 ) )
  3542.              ( label_ref ( match_operand 0 "" "" ) )
  3543.              ( pc ) ) ) ]
  3544.   ""
  3545.   "jge    %l0" )
  3546.  
  3547. ( define_expand "sgeu"
  3548.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3549.       ( geu ( cc0 ) ( const_int 0 ))) ]
  3550.   ""
  3551.   "
  3552. {
  3553.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3554.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3555.                gen_rtx ( GEU, VOIDmode, cc0_rtx, const0_rtx ));
  3556.         
  3557.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3558.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3559.     DONE;
  3560. }" )
  3561.     
  3562. ( define_insn ""
  3563.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3564.                ( geu ( cc0 ) ( const_int 0 )))
  3565.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3566.          ])
  3567.   ]
  3568.   ""
  3569.   "move    #>1,%1\;move    #0,%0\;tge    %1,%0" )
  3570.  
  3571. ( define_insn "bgeu"
  3572.   [ ( set ( pc )
  3573.       ( if_then_else ( geu ( cc0 )
  3574.                    ( const_int 0 ) )
  3575.              ( label_ref ( match_operand 0 "" "" ) )
  3576.              ( pc ) ) ) ]
  3577.   ""
  3578.   "jge    %l0" )
  3579.  
  3580. ( define_expand "sle"
  3581.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3582.       ( le ( cc0 ) ( const_int 0 ))) ]
  3583.   ""
  3584.   "
  3585. {
  3586.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3587.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3588.                gen_rtx ( LE, VOIDmode, cc0_rtx, const0_rtx ));
  3589.         
  3590.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3591.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3592.     DONE;
  3593. }" )
  3594.     
  3595. ( define_insn ""
  3596.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3597.                ( le ( cc0 ) ( const_int 0 )))
  3598.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3599.          ])
  3600.   ]
  3601.   ""
  3602.   "move    #>1,%1\;move    #0,%0\;tle    %1,%0" )
  3603.  
  3604. ( define_insn "ble"
  3605.   [ ( set ( pc )
  3606.       ( if_then_else ( le ( cc0 )
  3607.                   ( const_int 0 ) )
  3608.              ( label_ref ( match_operand 0 "" "" ) )
  3609.              ( pc ) ) ) ]
  3610.   ""
  3611.   "jle    %l0" )
  3612.  
  3613. ( define_expand "sleu"
  3614.   [ ( set ( match_operand:SI 0 "register_operand" "=D" )
  3615.       ( leu ( cc0 ) ( const_int 0 ))) ]
  3616.   ""
  3617.   "
  3618. {
  3619.     rtx clobber_exp = gen_rtx ( CLOBBER, VOIDmode, gen_reg_rtx ( SImode ));
  3620.     rtx set_exp = gen_rtx ( SET, VOIDmode, operands[0],
  3621.                gen_rtx ( LEU, VOIDmode, cc0_rtx, const0_rtx ));
  3622.         
  3623.     emit_insn ( gen_rtx ( PARALLEL, VOIDmode,
  3624.              gen_rtvec ( 2, set_exp, clobber_exp )));
  3625.     DONE;
  3626. }" )
  3627.     
  3628. ( define_insn ""
  3629.   [ ( parallel [ ( set ( match_operand:SI 0 "register_operand" "=&D" )
  3630.                ( leu ( cc0 ) ( const_int 0 )))
  3631.          ( clobber ( match_operand:SI 1 "register_operand" "=*S*D" ))
  3632.          ])
  3633.   ]
  3634.   ""
  3635.   "move    #>1,%1\;move    #0,%0\;tle    %1,%0" )
  3636.  
  3637. ( define_insn "bleu"
  3638.   [ ( set ( pc )
  3639.       ( if_then_else ( leu ( cc0 )
  3640.                    ( const_int 0 ) )
  3641.              ( label_ref ( match_operand 0 "" "" ) )
  3642.              ( pc ) ) ) ]
  3643.   ""
  3644.   "jle    %l0" )
  3645.  
  3646.  
  3647. ;;
  3648. ;;  ...........................................................................
  3649. ;;
  3650. ;;          CONDITIONAL JUMPS WITH INVERTED REGISTER ALLOCATION
  3651. ;;
  3652. ;;  ...........................................................................
  3653. ;;
  3654.  
  3655. ( define_insn ""
  3656.   [ ( set ( pc )
  3657.       ( if_then_else ( eq ( cc0 )
  3658.                   ( const_int 0 ) )
  3659.              ( pc )
  3660.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3661.   ""
  3662.   "jne    %l0" )
  3663.  
  3664. ( define_insn ""
  3665.   [ ( set ( pc )
  3666.       ( if_then_else ( equ ( cc0 )
  3667.                      ( const_int 0 ) )
  3668.              ( pc )
  3669.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3670.   ""
  3671.   "jne    %l0" )
  3672.  
  3673. ( define_insn ""
  3674.   [ ( set ( pc )
  3675.       ( if_then_else ( ne ( cc0 )
  3676.                   ( const_int 0 ) )
  3677.              ( pc )
  3678.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3679.   ""
  3680.   "jeq    %l0" )
  3681.  
  3682. ( define_insn ""
  3683.   [ ( set ( pc )
  3684.       ( if_then_else ( neu ( cc0 )
  3685.                    ( const_int 0 ) )
  3686.              ( pc )
  3687.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3688.   ""
  3689.   "jeq    %l0" )
  3690.  
  3691. ( define_insn ""
  3692.   [ ( set ( pc )
  3693.       ( if_then_else ( gt ( cc0 )
  3694.                   ( const_int 0 ) )
  3695.              ( pc )
  3696.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3697.   ""
  3698.   "jle    %l0" )
  3699.  
  3700. ( define_insn ""
  3701.   [ ( set ( pc )
  3702.       ( if_then_else ( gtu ( cc0 )
  3703.                    ( const_int 0 ) )
  3704.              ( pc )
  3705.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3706.   ""
  3707.   "jle    %l0" )
  3708.  
  3709. ( define_insn ""
  3710.   [ ( set ( pc )
  3711.       ( if_then_else ( lt ( cc0 )
  3712.                   ( const_int 0 ) )
  3713.              ( pc )
  3714.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3715.   ""
  3716.   "jge    %l0" )
  3717.  
  3718. ( define_insn ""
  3719.   [ ( set ( pc )
  3720.       ( if_then_else ( ltu ( cc0 )
  3721.                    ( const_int 0 ) )
  3722.              ( pc )
  3723.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3724.   ""
  3725.   "jge    %l0" )
  3726.  
  3727. ( define_insn ""
  3728.   [ ( set ( pc )
  3729.       ( if_then_else ( ge ( cc0 )
  3730.                   ( const_int 0 ) )
  3731.              ( pc )
  3732.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3733.   ""
  3734.   "jlt    %l0" )
  3735.  
  3736. ( define_insn ""
  3737.   [ ( set ( pc )
  3738.       ( if_then_else ( geu ( cc0 )
  3739.                    ( const_int 0 ) )
  3740.              ( pc )
  3741.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3742.   ""
  3743.   "jlt    %l0" )
  3744.  
  3745.  
  3746. ( define_insn ""
  3747.   [ ( set ( pc )
  3748.       ( if_then_else ( le ( cc0 )
  3749.                   ( const_int 0 ) )
  3750.              ( pc )
  3751.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3752.   ""
  3753.   "jgt    %l0" )
  3754.  
  3755.  
  3756. ( define_insn ""
  3757.   [ ( set ( pc )
  3758.       ( if_then_else ( leu ( cc0 )
  3759.                    ( const_int 0 ) )
  3760.              ( pc )
  3761.              ( label_ref ( match_operand 0 "" "" ) ) ) ) ]
  3762.   ""
  3763.   "jgt    %l0" )
  3764.  
  3765.  
  3766. ;;
  3767. ;;  ...........................................................................
  3768. ;;
  3769. ;;          CONDITIONALY STORE ZERO OR NON-ZERO
  3770. ;;
  3771. ;;  ...........................................................................
  3772. ;;
  3773.  
  3774. ;;
  3775. ;;  ...........................................................................
  3776. ;;
  3777. ;;          UNCONDITIONAL JUMP
  3778. ;;
  3779. ;;  ...........................................................................
  3780. ;;
  3781.  
  3782. ( define_insn "jump"
  3783.   [ ( set ( pc )
  3784.       ( label_ref ( match_operand 0 "" "" ) ) ) ]
  3785.   ""
  3786.   "jmp    %l0" )
  3787.  
  3788.  
  3789. ;;
  3790. ;;  ...........................................................................
  3791. ;;
  3792. ;;          TABLE JUMP ( SWITCH IMPLEMENTATION )
  3793. ;;
  3794. ;;  ...........................................................................
  3795. ;;
  3796.  
  3797. ( define_insn "tablejump"
  3798.   [ ( set ( pc ) ( match_operand:PSI 0 "register_operand" "A" ) )
  3799.     ( use ( label_ref ( match_operand 1 "" "" ) ) ) ]
  3800.   ""
  3801.   "jmp    (%0)" )
  3802.  
  3803.  
  3804. ;;
  3805. ;;  ...........................................................................
  3806. ;;
  3807. ;;          SUBROUTINE CALLS
  3808. ;;
  3809. ;;  ...........................................................................
  3810. ;;
  3811.  
  3812. ( define_expand "call"
  3813.   [ ( call ( match_operand:PSI 0 "general_operand" "mA" )
  3814.        ( match_operand:SI 1 "immediate_operand" "i" ))
  3815.   ]
  3816.   ""
  3817.   "
  3818. {
  3819.     emit_insn ( 
  3820.            gen_rtx ( PARALLEL,
  3821.             VOIDmode,
  3822.             gen_rtvec ( 1,
  3823.                    gen_rtx ( CALL, 
  3824.                         VOIDmode,
  3825.                         operands[0], operands[1] ))));
  3826.     DONE;
  3827. }" )
  3828.  
  3829. ( define_insn ""
  3830.   [ ( parallel [ ( call ( match_operand:PSI 0 "general_operand" "mA" )
  3831.             ( match_operand:SI 1 "immediate_operand" "i" )) ] )
  3832.   ]
  3833.   ""
  3834.   "*
  3835. {
  3836.     clear_n_reg_values ( );
  3837.     
  3838.     switch ( INTVAL ( operands[1] ))
  3839.     {
  3840.     case 0:
  3841.     return \"jsr    %0\";
  3842.     
  3843.     case 1:
  3844.     return \"jsr    %0\;move    (r6)-\";
  3845.     
  3846.     case 2:
  3847.     return \"jsr    %0\;move    (r6)-\;move    (r6)-\";
  3848.     
  3849.     default:
  3850.     return \"jsr    %0\;move    #%p1,n6\;move    (r6)-n6\";
  3851.     }
  3852. }" )
  3853.  
  3854. ( define_expand "call_value"
  3855.   [ ( set ( match_operand 0 "" "" )
  3856.       ( call ( match_operand:PSI 1 "general_operand" "mA" )
  3857.          ( match_operand:SI 2 "immediate_operand" "i" )))
  3858.   ]
  3859.   ""
  3860.   "
  3861. {
  3862.     emit_insn ( 
  3863.            gen_rtx ( PARALLEL, VOIDmode,
  3864.             gen_rtvec ( 1,
  3865.                    gen_rtx ( SET, VOIDmode,
  3866.                         operands[0],
  3867.                         gen_rtx ( CALL, VOIDmode,
  3868.                              operands[1],
  3869.                              operands[2] )))));
  3870.     DONE;
  3871. }" )
  3872.  
  3873. ( define_insn ""
  3874.   [ ( parallel [ ( set ( match_operand 0 "" "" )
  3875.                ( call ( match_operand:PSI 1 "general_operand" "mA" )
  3876.                   ( match_operand:SI 2 "immediate_operand" "i" )))
  3877.            ] )
  3878.   ]
  3879.   ""
  3880.   "*
  3881. {
  3882.     clear_n_reg_values ( );
  3883.     
  3884.     switch ( INTVAL ( operands[2] ))
  3885.     {
  3886.     case 0:
  3887.     return \"jsr    %1\";
  3888.     
  3889.     case 1:
  3890.     return \"jsr    %1\;move    (r6)-\";
  3891.     
  3892.     case 2:
  3893.     return \"jsr    %1\;move    (r6)-\;move    (r6)-\";
  3894.     
  3895.     default:
  3896.     return \"jsr    %1\;move    #%p2,n6\;move    (r6)-n6\";
  3897.     }
  3898. }" )
  3899.  
  3900.  
  3901. ;;
  3902. ;;  ...........................................................................
  3903. ;;
  3904. ;;          NOP
  3905. ;;
  3906. ;;  ...........................................................................
  3907. ;;
  3908.  
  3909. ( define_insn "nop"
  3910.   [ ( const_int 0 ) ]
  3911.   ""
  3912.   "*
  3913. {
  3914.     rtx peek = PREV_INSN ( insn );
  3915.     
  3916.     while (( peek ) && 
  3917.        (( NOTE == GET_CODE ( peek )) ||
  3918.         (( JUMP_INSN == GET_CODE ( peek )) &&
  3919.          ( PARALLEL == GET_CODE ( PATTERN ( peek ))))))
  3920.     {
  3921.     peek = PREV_INSN ( peek );
  3922.     }
  3923.     if (( ! peek ) || ( CODE_LABEL != GET_CODE ( peek )) ||
  3924.     ( ! LABEL_NUSES ( peek )))
  3925.     {
  3926.     return \"\";
  3927.     }
  3928.     
  3929.     peek = NEXT_INSN ( insn );
  3930.     while (( peek ) && 
  3931.        (( NOTE == GET_CODE ( peek )) ||
  3932.         (( JUMP_INSN == GET_CODE ( peek )) &&
  3933.          ( PARALLEL == GET_CODE ( PATTERN ( peek ))))))
  3934.     {
  3935.     peek = NEXT_INSN ( peek );
  3936.     }
  3937.     if (( ! peek ) || 
  3938.     ( ! LABEL_NUSES ( peek )) ||
  3939.     (( CODE_LABEL != GET_CODE ( peek )) && 
  3940.      ( const0_rtx != PATTERN ( peek ))))
  3941.     {
  3942.     return \"\";
  3943.     }
  3944.  
  3945.     return \"nop\";
  3946. }" )
  3947.  
  3948. ;; This insn is needed because jump.c doesn't realize that this is really
  3949. ;; a nop.
  3950.  
  3951. ( define_insn "" [ ( set ( pc ) ( pc )) ] "" "" )
  3952.  
  3953. ( define_insn "probe" 
  3954.   [ ( parallel [ ( const_int 0 ) ] ) ]
  3955.   ""
  3956.   "*
  3957. {
  3958.     if ( TARGET_STACK_CHECK )
  3959.     {
  3960.     return \"jsr    F__stack_check\";
  3961.     }
  3962.     else
  3963.     {
  3964.     return \"\";
  3965.     }
  3966. }" )
  3967.  
  3968. ;;
  3969. ;;  ...........................................................................
  3970. ;;
  3971. ;;          PEEPHOLE OPTIMIZATIONS
  3972. ;;
  3973. ;;  ...........................................................................
  3974. ;;
  3975.  
  3976. ;; this sequence can be introduced by the do loop generation code. a 
  3977. ;; reasonable data flow analysis and optimization phase will (in the future)
  3978. ;; clean it up.
  3979.  
  3980. ( define_peephole 
  3981.   [ ( set ( match_operand:SI 0 "register_operand" "=*D" )
  3982.       ( minus:SI ( match_operand:SI 1 "register_operand" "0" )
  3983.              ( match_operand:SI 2 "register_operand" "*S*D" )))
  3984.     ( set ( match_dup 0 )
  3985.       ( plus:SI ( match_dup 1 )
  3986.             ( match_dup 2 )))
  3987.   ]
  3988.   "( ! rtx_equal_p (operands[0], operands[2] ))" 
  3989.   "" )
  3990.  
  3991. ;;- Local variables:
  3992. ;;- mode:emacs-lisp
  3993. ;;- comment-start: ";;- "
  3994. ;;- eval: ( set-syntax-table ( copy-sequence ( syntax-table ) ) )
  3995. ;;- eval: ( modify-syntax-entry ?[ "(]" )
  3996. ;;- eval: ( modify-syntax-entry ?] ")[" )
  3997. ;;- eval: ( modify-syntax-entry ?{ "(}" )
  3998. ;;- eval: ( modify-syntax-entry ?} "){" )
  3999. ;;- End:
  4000.  
  4001.